var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var _a, _b, _c, _d, _e2, _f, _g;
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
import React, { useState, useRef, useEffect } from "react";
import { createPortal } from "react-dom";
const version = "1.1.1";
function o$1(r, e2) {
  if (r === e2) return true;
  if (r == null || e2 == null) return r === e2;
  if (typeof r != typeof e2) return false;
  if (r instanceof Date && e2 instanceof Date) return r.getTime() === e2.getTime();
  if (Array.isArray(r) && Array.isArray(e2)) {
    if (r.length !== e2.length) return false;
    for (let t2 = 0; t2 < r.length; t2++) if (!o$1(r[t2], e2[t2])) return false;
    return true;
  }
  if (r instanceof Object && e2 instanceof Object) {
    let t2 = Object.keys(r), s = Object.keys(e2);
    if (t2.length !== s.length) return false;
    for (let n2 of t2) if (!e2.hasOwnProperty(n2) || !o$1(r[n2], e2[n2])) return false;
    return true;
  }
  return false;
}
__name(o$1, "o$1");
function l$3(r) {
  try {
    let e2 = [], t2 = JSON.stringify(r, function(s, n2) {
      if (typeof n2 == "object" && n2 !== null) {
        if (e2.indexOf(n2) !== -1) return;
        e2.push(n2);
      }
      return n2;
    });
    return e2 = null, t2;
  } catch (e2) {
    return console.log("stringify error", e2), "";
  }
}
__name(l$3, "l$3");
var a$2 = /* @__PURE__ */ __name((r) => {
  var e2 = null, t2 = r.slice(0, 2);
  if (t2 === "on") {
    var s = r.charAt(2), n2 = r.charAt(2).toUpperCase();
    s === n2 && (e2 = r.slice(2).toLowerCase());
  }
  return window.Ext.isClassic === true && e2 === "tap" && (e2 = "click"), e2;
}, "a$2");
var p$1 = /* @__PURE__ */ __name((r, e2, t2) => {
  if (!(typeof window === void 0 || typeof window > "u")) {
    var s = /* @__PURE__ */ __name((d2) => {
      let i2 = d2.charAt(0).toUpperCase(), f = d2.slice(1);
      var u2 = "set" + (i2 + f);
      return u2;
    }, "s"), n2;
    window.Ext.isClassic === true ? e2 === "items" ? (r.removeAll(true), r.add(t2)) : e2 !== "layout" && (n2 = s(e2), r[n2] !== void 0 ? r[n2](t2) : r[e2] = t2) : (n2 = s(e2), r[n2] !== void 0 && r[n2](t2));
  }
}, "p$1");
function y(r, e2, t2, s, n2) {
  try {
    delete e2.children, delete t2.children;
    for (let [i2] of Object.entries(e2)) {
      if (a$2(i2) != null || i2 === "xtype" || i2 === "items") return;
      t2[i2] !== void 0 && t2[i2] !== null && t2[i2].listeners !== void 0 && delete t2[i2].listeners, e2[i2] !== void 0 && e2[i2] !== null && e2[i2].listeners !== void 0 && delete e2[i2].listeners;
      let f;
      if (i2 === "series") f = true;
      else {
        var d2 = l$3(t2[i2]), c2 = l$3(e2[i2]);
        f = o$1(c2, d2);
      }
      f === false && (i2 === "store" ? s.reconfigure && s.reconfigure(t2[i2]) : p$1(s, i2, t2[i2]));
    }
  } catch (i2) {
    console.log("compareOldAndNewProps error", i2);
  }
}
__name(y, "y");
var l$2 = /* @__PURE__ */ __name((d2) => {
  var t2 = null, n2 = d2.slice(0, 2);
  if (n2 === "on") {
    var r = d2.charAt(2), e2 = d2.charAt(2).toUpperCase();
    r === e2 && (t2 = d2.slice(2).toLowerCase());
  }
  return window.Ext.isClassic === true && t2 === "tap" && (t2 = "click"), t2;
}, "l$2");
var u = /* @__PURE__ */ __name((d2, t2, n2, r) => {
  if (!(typeof window === void 0 || typeof window > "u")) {
    var e2 = {};
    if (e2.xtype = d2, t2 !== void 0) for (let [i2, o2] of Object.entries(t2)) e2[i2] = o2;
    if (n2.references === true && (e2.controller = window.Ext.create("Ext.app.ViewController")), e2.store !== void 0 && (e2.store.listeners !== void 0 ? e2.store.listeners.load === void 0 && (e2.store.listeners.load = (i2) => {
      n2.storeloaded !== void 0 && n2.storeloaded(i2, r()), n2.onStoreloaded !== void 0 && n2.onStoreloaded(i2, r());
    }) : e2.store.listeners = { load: /* @__PURE__ */ __name((i2) => {
      n2.storeloaded !== void 0 && n2.storeloaded(i2, r()), n2.onStoreloaded !== void 0 && n2.onStoreloaded(i2, r());
    }, "load") }), e2.listeners === void 0) {
      e2.listeners = {};
      for (let [i2, o2] of Object.entries(n2)) {
        var f = l$2(i2);
        f !== null && (e2.listeners[f] = function() {
          o2(...arguments);
        });
      }
      Object.keys(e2.listeners).length === 0 && delete e2.listeners;
    }
    return e2;
  }
}, "u");
var T$1 = /* @__PURE__ */ __name((o2, d2, f, s, p2) => {
  var l2 = [];
  if (!(typeof window === void 0 || typeof window > "u")) {
    var n2 = [], u2 = [], r = [];
    if (o2 === void 0) return { childarray: [] };
    o2.length === void 0 ? n2.push(o2) : n2 = o2, d2.length === void 0 ? u2.push(d2) : u2 = d2;
    var a2 = 0;
    try {
      n2.forEach((t2, N2) => {
        var P2 = u2[N2];
        if (f.xtype !== "tabpanel") {
          var c2 = t2.props.childHeight, y2 = t2.props.childWidth, x2 = t2.props.childFlex, m2 = t2.props.childRegion, w2 = t2.props.childSplit;
          let e2 = {};
          e2.xtype = "container", e2.layout = "fit", e2.name = "portalcontainer", e2.cls = "portalcontainer";
          var v = false;
          c2 !== void 0 && (e2.height = c2, v = true), y2 !== void 0 && (e2.width = y2, v = true), v === false && (x2 !== void 0 ? e2.flex = x2 : e2.flex = 1), m2 !== void 0 && (e2.region = m2), w2 !== void 0 && (e2.split = w2), e2.items = [{ xtype: "container", layout: "fit", name: "portalroot", cls: "portalroot", style: { flex: 1, display: "flex", height: "100%", width: "100%" }, listeners: { render: /* @__PURE__ */ __name((i2) => {
            r.push(i2.el.dom), a2++, a2 === n2.length && p2(r);
            var R2 = i2.el.dom.parentNode;
            s.observe(R2);
          }, "render") } }], l2.push(e2);
        }
        if (f.xtype == "tabpanel") {
          var h;
          window.Ext.ReExtTheme === "classic" ? h = "Ext.panel.Panel" : h = "Ext.Panel";
          var g2;
          g2 = window.Ext.create(h, { layout: "fit", title: t2.props.title, cls: "ReExtTabChildRoot", items: [{ xtype: "component", listeners: { activate: /* @__PURE__ */ __name((e2) => {
            r.push(e2.el.dom), a2++, a2 === n2.length && p2(r);
            var i2 = e2.el.dom.parentNode;
            s.observe(i2);
          }, "activate"), render: /* @__PURE__ */ __name((e2) => {
            r.push(e2.el.dom), a2++, a2 === n2.length && p2(r);
            var i2 = e2.el.dom.parentNode;
            s.observe(i2);
          }, "render") }, style: { display: "flex", height: "100%", width: "100%" } }] }), l2.push(g2);
        }
      }), l2.length > 0 && (f.removeAll(), f.add(l2));
      var E = { childarray: l2 };
      return E;
    } catch (t2) {
      return console.error("iteratechildren:", t2.toString()), [];
    }
  }
}, "T$1");
var a$1 = /* @__PURE__ */ __name(() => {
  var t2;
  return typeof ResizeObserver < "u" ? (t2 = new ResizeObserver((o2) => {
    if (!(typeof window === void 0 || typeof window > "u")) for (let n2 of o2) {
      var r = 0, e2 = n2.target.children.item(r);
      if (e2 !== null && n2.contentBoxSize) {
        let i2 = n2.contentBoxSize[0];
        var s = i2.inlineSize, f = window.Ext.getCmp(e2.id);
        if (f !== void 0) window.Ext.getCmp(e2.id).setWidth(s), window.Ext.getCmp(e2.id).setHeight(i2.blockSize);
        else if (!e2.classList.contains("wm")) {
          console.log("child not found", e2.id);
          var d2 = e2.getAttribute("w");
          d2 !== "w" && console.warn("child not resized", e2);
        }
      }
    }
  }), t2) : null;
}, "a$1");
async function o() {
  return await new Promise((e2) => {
    function t2() {
      window.Ext !== void 0 && window.Ext.onReady(function() {
        return clearInterval(n2), e2(1);
      });
    }
    __name(t2, "t");
    var n2 = setInterval(t2, 5);
  });
}
__name(o, "o");
var d$1 = /* @__PURE__ */ __name((t2, n2, l2) => {
  if (typeof window > "u") return;
  let e2 = document.createElement("div");
  e2.style.display = "block !important", e2.style.zIndex = 2e4, e2.style.position = "absolute", e2.style.bottom = "0px", e2.style.right = "0px", e2.style.color = "white", e2.style.fontSize = "10px", e2.style.fontWeight = "bold", e2.style.fontStyle = "italic", e2.style.background = "#B87333", e2.style.padding = "1px 3px 1px 1px", e2.style.border = "1px solid lightgray", e2.style.borderRadius = "3px 3px 3px 3px", e2.innerText = "ReExt " + n2;
  l2 !== null ? l2.appendChild(e2) : t2.el !== void 0 && t2.el.dom.appendChild(e2);
}, "d$1");
function doLogo(props, version2, type, React2) {
  var nextVersion = null;
  try {
    const nextPackage = require("next/package.json");
    nextVersion = nextPackage.version;
  } catch (e2) {
  }
  var extlocation = "";
  var extver = "";
  var exttoolkit = "";
  var exttheme = "";
  if (window["Ext"] !== void 0) {
    if (window["Ext"].versions !== null) {
      if (window["Ext"].versions !== void 0) {
        extver = window["Ext"].versions.core.version;
        exttheme = window["Ext"].ReExtTheme;
        extlocation = window["Ext"].ReExtLocation;
        var classic = window["Ext"].isClassic;
        if (classic === true) {
          exttoolkit = "classic";
        } else {
          exttoolkit = "modern";
        }
      }
    }
  }
  return /* @__PURE__ */ jsxs(
    "div",
    {
      name: "ReExtRootLogo",
      "data-rid": props.rid,
      style: { ...{ display: "flex", flexDirection: props.flexdirection, alignItems: "center", color: "black", padding: 5 }, ...props.style },
      children: [
        /* @__PURE__ */ jsx("img", { style: { height: 40, width: 80 }, src: "../ReExt/ReExt.png" }),
        /* @__PURE__ */ jsxs("div", { style: { margin: "0 0 0 3px" }, children: [
          /* @__PURE__ */ jsx("div", { style: { ...{ margin: "0 0 0 1px", fontSize: 12, color: "black" } }, children: /* @__PURE__ */ jsx("a", { xstyle: props.style, target: "_blank", rel: "noreferrer", href: "https://www.npmjs.com/package/@sencha/reext", children: /* @__PURE__ */ jsxs("i", { children: [
            "ReExt ",
            version2
          ] }) }) }),
          /* @__PURE__ */ jsx("div", { style: { fontSize: "10px", margin: "2px 0 0 0" } }),
          /* @__PURE__ */ jsx("div", { style: { fontSize: "10px", margin: "2px 0 0 0" }, children: /* @__PURE__ */ jsxs("span", { style: { margin: "0 0 0 0" }, children: [
            "React: ",
            /* @__PURE__ */ jsx("b", { children: React2.version })
          ] }) }),
          /* @__PURE__ */ jsx("div", { style: { fontSize: "10px", margin: "2px 0 0 0" }, children: /* @__PURE__ */ jsxs("span", { style: { margin: "0 0 0 0" }, children: [
            "ExtJS: ",
            /* @__PURE__ */ jsxs("b", { children: [
              extver,
              " (",
              extlocation,
              ")"
            ] })
          ] }) }),
          nextVersion !== null && /* @__PURE__ */ jsx("div", { style: { fontSize: "10px", margin: "2px 0 0 0" }, children: /* @__PURE__ */ jsxs("span", { style: { margin: "0 0 0 0" }, children: [
            "Next.js: ",
            /* @__PURE__ */ jsx("b", { children: nextVersion })
          ] }) }),
          /* @__PURE__ */ jsxs("div", { style: { fontSize: "10px", margin: "2px 0 0 0" }, children: [
            /* @__PURE__ */ jsxs("span", { style: { margin: "0 0 0 0" }, children: [
              "toolkit: ",
              /* @__PURE__ */ jsx("b", { children: exttoolkit })
            ] }),
            /* @__PURE__ */ jsxs("span", { style: { margin: "0 0 0 5px" }, children: [
              "theme: ",
              /* @__PURE__ */ jsx("b", { children: exttheme })
            ] })
          ] })
        ] })
      ]
    }
  );
}
__name(doLogo, "doLogo");
function l$1(n2) {
  var t2 = [];
  Array.isArray(n2) ? t2 = n2 : t2 = [n2];
  var a2 = [];
  for (let i2 of t2) {
    var e2 = { ...i2.props };
    if (delete e2.listeners, i2.type.name === void 0 ? e2.name = i2.type : e2.name = i2.type.name, e2.name.startsWith("ReExt")) {
      if (e2.children !== void 0) {
        var r = [];
        Array.isArray(e2.children) ? r = e2.children : r = [e2.children], e2.children = l$1(r);
      }
      a2.push(e2);
    } else delete e2.children, a2.push(e2);
  }
  return a2;
}
__name(l$1, "l$1");
function i(n2) {
  try {
    let t2 = [], e2 = JSON.stringify(n2, function(f, r) {
      if (typeof r == "object" && r !== null) {
        if (t2.indexOf(r) !== -1) return;
        t2.push(r);
      }
      return r;
    });
    return t2 = null, e2;
  } catch (t2) {
    return console.log("stringify error", t2), "";
  }
}
__name(i, "i");
function e$1(t2, r) {
  if (t2 === r) return true;
  if (t2 == null || r == null) return t2 === r;
  if (typeof t2 != typeof r) return false;
  if (t2 instanceof Date && r instanceof Date) return t2.getTime() === r.getTime();
  if (Array.isArray(t2) && Array.isArray(r)) {
    if (t2.length !== r.length) return false;
    for (let n2 = 0; n2 < t2.length; n2++) if (!e$1(t2[n2], r[n2])) return false;
    return true;
  }
  if (t2 instanceof Object && r instanceof Object) {
    let n2 = Object.keys(t2), i2 = Object.keys(r);
    if (n2.length !== i2.length) return false;
    for (let f of n2) if (!r.hasOwnProperty(f) || !e$1(t2[f], r[f])) return false;
    return true;
  }
  return false;
}
__name(e$1, "e$1");
const ReExt = /* @__PURE__ */ __name((props) => {
  if (typeof window === void 0 || typeof window === "undefined") {
    return;
  }
  if (props.xtype === "window") {
    return null;
  }
  var type = window.tt;
  const [dom, setDom] = useState(null);
  const [rootstyle, setRootStyle] = useState(null);
  const [rootclassname, setRootClassName] = useState(null);
  const [extcmp, setExtCmp] = useState(null);
  const extcmpRef = useRef(null);
  extcmpRef.current = extcmp;
  const getExtCmp = /* @__PURE__ */ __name(() => {
    return extcmpRef.current;
  }, "getExtCmp");
  const [currchildren, setCurrChildren] = useState(null);
  const [currconfig, setCurrConfig] = useState(null);
  const [currstyle, setCurrStyle] = useState(null);
  const currconfigRef = useRef(null);
  currconfigRef.current = currconfig;
  const getCurrConfig = /* @__PURE__ */ __name(() => {
    return currconfigRef.current;
  }, "getCurrConfig");
  const ReExtRootRef = useRef(null);
  var resizeObserver = a$1();
  if (props.xtype === "logo") {
    return doLogo(props, version, type, React);
  }
  useEffect(() => {
    setCurrStyle(props.style);
    setCurrConfig(props.config);
    setCurrChildren(props.children);
    var cmp;
    var returnHit = "false";
    if (typeof window === void 0 || typeof window === "undefined") {
      return;
    }
    (async () => {
      await o();
      if (returnHit === "false") {
        if (props.xtype !== "logo") {
          var latestconfig;
          if (getCurrConfig() == null) {
            latestconfig = props.config;
          } else {
            latestconfig = getCurrConfig();
          }
          try {
            var o$12 = u(props.xtype, latestconfig, props, getExtCmp);
            var f = Ext.ClassManager.getByAlias("widget." + o$12.xtype);
            if (f === void 0) {
              var message = "ReExt " + o$12.xtype + " could not be created";
              o$12 = { xtype: "label", text: message, style: { color: "red", background: "lightgray" } };
            }
            if (o$12.height === void 0) {
              if (o$12.xtype !== "window") {
                if (window["Ext"].isClassic === true && o$12.xtype === "grid") {
                  o$12.height = 0;
                } else {
                  o$12.height = "100%";
                }
              }
            }
            if (o$12.width === void 0) {
              if (o$12.xtype !== "window") {
                if (window["Ext"].isClassic === true && o$12.xtype === "grid") {
                  o$12.width = 0;
                } else {
                  o$12.width = "100%";
                }
              }
            }
            if (window["Ext"].isClassic === true) {
              const boxready = /* @__PURE__ */ __name((c2) => {
                var parent2 = c2.el.dom.parentNode;
                resizeObserver.observe(parent2);
              }, "boxready");
              if (o$12.listeners === void 0) {
                o$12.listeners = { boxready };
              } else {
                o$12.listeners.boxready = boxready;
              }
            }
            if (o$12.xtype !== "window") {
              o$12.renderTo = ReExtRootRef.current;
            }
            if (o$12.xtype === "tabpanel") {
              o$12.deferredRender = false;
            }
            if (o$12.xtype === "panel" || o$12.xtype === "container") {
              if (o$12.layout === void 0) {
                o$12.layout = { type: "vbox", align: "stretch" };
              }
            }
            cmp = window["Ext"].create(o$12);
            setExtCmp(cmp);
            extcmpRef.current = cmp;
            if (o$12.xtype.startsWith("d3-")) {
              var parent = ReExtRootRef.current;
              resizeObserver.observe(parent);
            }
            if (props.config !== void 0) {
              if (props.config.reference !== void 0) {
                if (props.ReExtParent !== void 0) {
                  if (props.ReExtParent.ReExtChildren === void 0) {
                    props.ReExtParent.ReExtChildren = [];
                  }
                  props.ReExtParent.ReExtChildren.push(cmp);
                }
              }
            }
            if (type !== null) {
              if (type !== "production") {
                d$1(cmp, o$12.xtype, ReExtRootRef.current);
              }
            }
            const a2 = T$1(props.children, {}, extcmpRef.current, resizeObserver, setDom);
            setCurrChildren(props.children);
            if (props.ready !== void 0) {
              props.ready(cmp);
            }
          } catch (e2) {
            console.error("ReExt.jsx:", e2);
          }
        }
      }
    })();
    return () => {
      returnHit = "true";
      if (typeof window === void 0 || typeof window === "undefined") {
        return;
      }
      if (window["Ext"] !== void 0) {
        if (window["Ext"].destroy !== void 0) {
          if (cmp !== null && cmp !== void 0) {
            setExtCmp(null);
            window["Ext"].destroy(cmp);
          }
        }
      }
    };
  }, []);
  useEffect(() => {
    if (typeof window === void 0 || typeof window === "undefined") {
      return;
    }
    setCurrConfig(props.config);
    if (props.config === void 0) {
      return;
    }
    if (extcmpRef.current === null) {
      return;
    }
    var oldconfig = currconfigRef.current;
    var newconfig = props.config;
    var extcmp2 = extcmpRef.current;
    y("config", oldconfig, newconfig, extcmp2, props.xtype);
  }, [props.config, extcmpRef.current]);
  useEffect(() => {
    if (typeof window === void 0 || typeof window === "undefined") {
      return;
    }
    if (props.children === void 0) {
      return;
    }
    if (currchildren === null) {
      return;
    }
    if (extcmpRef.current === null) {
      return;
    }
    {
      if (props.children.length !== currchildren.length) {
        T$1(props.children, currchildren, extcmpRef.current, resizeObserver, setDom);
      } else {
        let whichPropsAreDifferent = /* @__PURE__ */ __name(function(newPropsArray, oldPropsArray) {
          const differences = [];
          function compareProps(newProps, oldProps, path = "") {
            const allKeys = /* @__PURE__ */ new Set([...Object.keys(newProps), ...Object.keys(oldProps)]);
            allKeys.forEach((key) => {
              const newValue = newProps[key];
              const oldValue = oldProps[key];
              const currentPath = path ? `${path}.${key}` : key;
              if (typeof newValue === "object" && newValue !== null && typeof oldValue === "object" && oldValue !== null) {
                compareProps(newValue, oldValue, currentPath);
              } else if (newValue !== oldValue) {
                differences.push(currentPath);
              }
            });
          }
          __name(compareProps, "compareProps");
          newPropsArray.forEach((newProps, index) => {
            const oldProps = oldPropsArray[index];
            compareProps(newProps, oldProps, `index${index}`);
          });
          return differences;
        }, "whichPropsAreDifferent");
        var newpropschildarray = l$1(props.children);
        var oldpropschildarray = l$1(currchildren);
        var newS = i(newpropschildarray);
        var oldS = i(oldpropschildarray);
        var i$1 = e$1(oldS, newS);
        if (!i$1) {
          const differences = whichPropsAreDifferent(newpropschildarray, oldpropschildarray);
          const hasChildDifferences = differences.some((diff) => {
            var r = diff.includes("childRegion") || diff.includes("childSplit") || diff.includes("childHeight") || diff.includes("childWidth");
            return r;
          });
          if (hasChildDifferences) {
            T$1(props.children, currchildren, extcmpRef.current, resizeObserver, setDom);
          }
        }
      }
    }
    setCurrChildren(props.children);
  }, [props.children, extcmpRef.current]);
  useEffect(() => {
    if (typeof window === void 0 || typeof window === "undefined") {
      return;
    }
    var rootConfigs = {};
    if (props.flex !== void 0) {
      rootConfigs.flex = props.flex;
    } else {
      if (props.rootStyle !== void 0) {
        if (props.rootStyle.flex !== void 0) {
          rootConfigs.flex = props.rootStyle.flex;
        } else {
          rootConfigs.flex = 1;
        }
      } else {
        rootConfigs.flex = 1;
      }
    }
    var propsstyle = {};
    if (props.style !== void 0) {
      propsstyle = props.style;
    }
    if (props.rootStyle !== void 0) {
      propsstyle = props.rootStyle;
    }
    if (propsstyle.width !== void 0) {
      delete rootConfigs.flex;
    }
    var rootstyle2 = {
      ...rootConfigs,
      ...propsstyle,
      ...{
        position: "relative",
        display: "flex",
        overflow: "hidden"
      }
    };
    setRootStyle(rootstyle2);
    var propsclassname = "";
    if (props.className !== void 0) {
      propsclassname = props.className;
    }
    if (props.rootClassName !== void 0) {
      propsclassname = props.rootClassName;
    }
    setRootClassName(propsclassname);
  }, [dom, props.style, props.rootStyle, props.className, props.rootClassName]);
  if (rootstyle !== null && rootclassname !== null) {
    return /* @__PURE__ */ jsx(
      "div",
      {
        name: "ReExtRoot-" + props.xtype,
        "data-rid": props.rid,
        className: rootclassname,
        style: rootstyle,
        ref: ReExtRootRef,
        children: dom !== null && dom.map((domitem, i2) => {
          if (dom.length === 1) {
            if (props.children.length !== void 0) {
              return;
            }
            var child = props.children;
            var style = {};
            if (child.props === void 0) {
              style = { display: "flex", flex: 1 };
            } else {
              if (child.props.style === void 0) {
                style = { display: "flex", flex: 1 };
              } else {
                style = { ...child.props.style, flex: 1 };
              }
            }
            var modifiedChild = React.cloneElement(child, { style });
            var p2 = createPortal(modifiedChild, domitem);
            return p2;
          } else {
            if (dom.length !== props.children.length) {
              return;
            }
            var child = props.children[i2];
            var style = {};
            if (child.props === void 0) {
              style = { display: "flex", flex: 1 };
            } else {
              if (child.props.style === void 0) {
                style = { display: "flex", flex: 1 };
              } else {
                style = { ...child.props.style, flex: 1 };
              }
            }
            var modifiedChild = React.cloneElement(child, { style });
            var p2 = createPortal(modifiedChild, domitem);
            return p2;
          }
        })
      }
    );
  }
}, "ReExt");
var n = Object.defineProperty;
var t = /* @__PURE__ */ __name((o2, d2) => n(o2, "name", { value: d2, configurable: true }), "t");
async function e() {
  if (typeof window === void 0 || typeof window > "u") return;
  function o2(d2) {
    d2.style.width = "100%", d2.style.height = "100%", d2.style.margin = "0", d2.style.padding = "0", d2.style.padding = "0", d2.style.boxSizing = "border-box", d2.style.overflow = "hidden";
  }
  __name(o2, "o");
  t(o2, "doFill"), document.documentElement && o2(document.documentElement), document.body && o2(document.body), document.getElementById("root") && o2(document.getElementById("root"));
}
__name(e, "e");
t(e, "Fill");
function ReExtSplash() {
  return /* @__PURE__ */ jsx("div", { className: "splash", style: {
    fontSize: "36px",
    border: "10px solid #0960a5",
    width: "100%",
    height: "100%",
    margin: 0,
    padding: 0,
    boxSizing: "border-box",
    overflow: "hidden",
    display: "flex",
    flexDirection: "column",
    flex: 1,
    justifyContent: "center",
    alignItems: "center"
  }, children: /* @__PURE__ */ jsx("img", { style: { height: 500, width: 1e3 }, src: "../ReExt/ReExt.png" }) });
}
__name(ReExtSplash, "ReExtSplash");
var we = /* @__PURE__ */ __name((e2, r) => () => (r || e2((r = { exports: {} }).exports, r), r.exports), "we");
var Ee = we(() => {
});
var w = crypto, R = /* @__PURE__ */ __name((e2) => e2 instanceof CryptoKey, "R");
var g = new TextEncoder(), d = new TextDecoder();
function re(...e2) {
  let r = e2.reduce((i2, { length: s }) => i2 + s, 0), n2 = new Uint8Array(r), t2 = 0;
  for (let i2 of e2) n2.set(i2, t2), t2 += i2.length;
  return n2;
}
__name(re, "re");
var ge = /* @__PURE__ */ __name((e2) => {
  let r = atob(e2), n2 = new Uint8Array(r.length);
  for (let t2 = 0; t2 < r.length; t2++) n2[t2] = r.charCodeAt(t2);
  return n2;
}, "ge"), x = /* @__PURE__ */ __name((e2) => {
  let r = e2;
  r instanceof Uint8Array && (r = d.decode(r)), r = r.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
  try {
    return ge(r);
  } catch {
    throw new TypeError("The input to be decoded is not correctly encoded.");
  }
}, "x");
var _ = (_a = class extends Error {
  static get code() {
    return "ERR_JOSE_GENERIC";
  }
  constructor(r) {
    var _a2;
    super(r), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (_a2 = Error.captureStackTrace) == null ? void 0 : _a2.call(Error, this, this.constructor);
  }
}, __name(_a, "_"), _a), p = (_b = class extends _ {
  static get code() {
    return "ERR_JWT_CLAIM_VALIDATION_FAILED";
  }
  constructor(r, n2, t2 = "unspecified", i2 = "unspecified") {
    super(r), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = t2, this.reason = i2, this.payload = n2;
  }
}, __name(_b, "p"), _b), I = (_c = class extends _ {
  static get code() {
    return "ERR_JWT_EXPIRED";
  }
  constructor(r, n2, t2 = "unspecified", i2 = "unspecified") {
    super(r), this.code = "ERR_JWT_EXPIRED", this.claim = t2, this.reason = i2, this.payload = n2;
  }
}, __name(_c, "I"), _c), m = (_d = class extends _ {
  constructor() {
    super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
  }
  static get code() {
    return "ERR_JOSE_NOT_SUPPORTED";
  }
}, __name(_d, "m"), _d);
var l = (_e2 = class extends _ {
  constructor() {
    super(...arguments), this.code = "ERR_JWS_INVALID";
  }
  static get code() {
    return "ERR_JWS_INVALID";
  }
}, __name(_e2, "l"), _e2), a = (_f = class extends _ {
  constructor() {
    super(...arguments), this.code = "ERR_JWT_INVALID";
  }
  static get code() {
    return "ERR_JWT_INVALID";
  }
}, __name(_f, "a"), _f);
var P = (_g = class extends _ {
  constructor() {
    super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
  }
  static get code() {
    return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
  }
}, __name(_g, "P"), _g);
function b(e2, r = "algorithm.name") {
  return new TypeError(`CryptoKey does not support this operation, its ${r} must be ${e2}`);
}
__name(b, "b");
function C(e2, r) {
  return e2.name === r;
}
__name(C, "C");
function K(e2) {
  return parseInt(e2.name.slice(4), 10);
}
__name(K, "K");
function Ie(e2) {
  switch (e2) {
    case "ES256":
      return "P-256";
    case "ES384":
      return "P-384";
    case "ES512":
      return "P-521";
    default:
      throw new Error("unreachable");
  }
}
__name(Ie, "Ie");
function De(e2, r) {
  if (r.length && !r.some((n2) => e2.usages.includes(n2))) {
    let n2 = "CryptoKey does not support this operation, its usages must include ";
    if (r.length > 2) {
      let t2 = r.pop();
      n2 += `one of ${r.join(", ")}, or ${t2}.`;
    } else r.length === 2 ? n2 += `one of ${r[0]} or ${r[1]}.` : n2 += `${r[0]}.`;
    throw new TypeError(n2);
  }
}
__name(De, "De");
function ne(e2, r, ...n2) {
  switch (r) {
    case "HS256":
    case "HS384":
    case "HS512": {
      if (!C(e2.algorithm, "HMAC")) throw b("HMAC");
      let t2 = parseInt(r.slice(2), 10);
      if (K(e2.algorithm.hash) !== t2) throw b(`SHA-${t2}`, "algorithm.hash");
      break;
    }
    case "RS256":
    case "RS384":
    case "RS512": {
      if (!C(e2.algorithm, "RSASSA-PKCS1-v1_5")) throw b("RSASSA-PKCS1-v1_5");
      let t2 = parseInt(r.slice(2), 10);
      if (K(e2.algorithm.hash) !== t2) throw b(`SHA-${t2}`, "algorithm.hash");
      break;
    }
    case "PS256":
    case "PS384":
    case "PS512": {
      if (!C(e2.algorithm, "RSA-PSS")) throw b("RSA-PSS");
      let t2 = parseInt(r.slice(2), 10);
      if (K(e2.algorithm.hash) !== t2) throw b(`SHA-${t2}`, "algorithm.hash");
      break;
    }
    case "EdDSA": {
      if (e2.algorithm.name !== "Ed25519" && e2.algorithm.name !== "Ed448") throw b("Ed25519 or Ed448");
      break;
    }
    case "ES256":
    case "ES384":
    case "ES512": {
      if (!C(e2.algorithm, "ECDSA")) throw b("ECDSA");
      let t2 = Ie(r);
      if (e2.algorithm.namedCurve !== t2) throw b(t2, "algorithm.namedCurve");
      break;
    }
    default:
      throw new TypeError("CryptoKey does not support this operation");
  }
  De(e2, n2);
}
__name(ne, "ne");
function te(e2, r, ...n2) {
  var _a2;
  if (n2.length > 2) {
    let t2 = n2.pop();
    e2 += `one of type ${n2.join(", ")}, or ${t2}.`;
  } else n2.length === 2 ? e2 += `one of type ${n2[0]} or ${n2[1]}.` : e2 += `of type ${n2[0]}.`;
  return r == null ? e2 += ` Received ${r}` : typeof r == "function" && r.name ? e2 += ` Received function ${r.name}` : typeof r == "object" && r != null && ((_a2 = r.constructor) == null ? void 0 : _a2.name) && (e2 += ` Received an instance of ${r.constructor.name}`), e2;
}
__name(te, "te");
var j = /* @__PURE__ */ __name((e2, ...r) => te("Key must be ", e2, ...r), "j");
function M(e2, r, ...n2) {
  return te(`Key for the ${e2} algorithm must be `, r, ...n2);
}
__name(M, "M");
var J = /* @__PURE__ */ __name((e2) => R(e2) ? true : (e2 == null ? void 0 : e2[Symbol.toStringTag]) === "KeyObject", "J"), A = ["CryptoKey"];
var Re = /* @__PURE__ */ __name((...e2) => {
  let r = e2.filter(Boolean);
  if (r.length === 0 || r.length === 1) return true;
  let n2;
  for (let t2 of r) {
    let i2 = Object.keys(t2);
    if (!n2 || n2.size === 0) {
      n2 = new Set(i2);
      continue;
    }
    for (let s of i2) {
      if (n2.has(s)) return false;
      n2.add(s);
    }
  }
  return true;
}, "Re"), ie = Re;
function $e(e2) {
  return typeof e2 == "object" && e2 !== null;
}
__name($e, "$e");
function k(e2) {
  if (!$e(e2) || Object.prototype.toString.call(e2) !== "[object Object]") return false;
  if (Object.getPrototypeOf(e2) === null) return true;
  let r = e2;
  for (; Object.getPrototypeOf(r) !== null; ) r = Object.getPrototypeOf(r);
  return Object.getPrototypeOf(e2) === r;
}
__name(k, "k");
var se = /* @__PURE__ */ __name((e2, r) => {
  if (e2.startsWith("RS") || e2.startsWith("PS")) {
    let { modulusLength: n2 } = r.algorithm;
    if (typeof n2 != "number" || n2 < 2048) throw new TypeError(`${e2} requires key modulusLength to be 2048 bits or larger`);
  }
}, "se");
function Pe(e2) {
  let r, n2;
  switch (e2.kty) {
    case "RSA": {
      switch (e2.alg) {
        case "PS256":
        case "PS384":
        case "PS512":
          r = { name: "RSA-PSS", hash: `SHA-${e2.alg.slice(-3)}` }, n2 = e2.d ? ["sign"] : ["verify"];
          break;
        case "RS256":
        case "RS384":
        case "RS512":
          r = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${e2.alg.slice(-3)}` }, n2 = e2.d ? ["sign"] : ["verify"];
          break;
        case "RSA-OAEP":
        case "RSA-OAEP-256":
        case "RSA-OAEP-384":
        case "RSA-OAEP-512":
          r = { name: "RSA-OAEP", hash: `SHA-${parseInt(e2.alg.slice(-3), 10) || 1}` }, n2 = e2.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
          break;
        default:
          throw new m('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
      }
      break;
    }
    case "EC": {
      switch (e2.alg) {
        case "ES256":
          r = { name: "ECDSA", namedCurve: "P-256" }, n2 = e2.d ? ["sign"] : ["verify"];
          break;
        case "ES384":
          r = { name: "ECDSA", namedCurve: "P-384" }, n2 = e2.d ? ["sign"] : ["verify"];
          break;
        case "ES512":
          r = { name: "ECDSA", namedCurve: "P-521" }, n2 = e2.d ? ["sign"] : ["verify"];
          break;
        case "ECDH-ES":
        case "ECDH-ES+A128KW":
        case "ECDH-ES+A192KW":
        case "ECDH-ES+A256KW":
          r = { name: "ECDH", namedCurve: e2.crv }, n2 = e2.d ? ["deriveBits"] : [];
          break;
        default:
          throw new m('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
      }
      break;
    }
    case "OKP": {
      switch (e2.alg) {
        case "EdDSA":
          r = { name: e2.crv }, n2 = e2.d ? ["sign"] : ["verify"];
          break;
        case "ECDH-ES":
        case "ECDH-ES+A128KW":
        case "ECDH-ES+A192KW":
        case "ECDH-ES+A256KW":
          r = { name: e2.crv }, n2 = e2.d ? ["deriveBits"] : [];
          break;
        default:
          throw new m('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
      }
      break;
    }
    default:
      throw new m('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
  }
  return { algorithm: r, keyUsages: n2 };
}
__name(Pe, "Pe");
var Ce = /* @__PURE__ */ __name(async (e2) => {
  if (!e2.alg) throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
  let { algorithm: r, keyUsages: n2 } = Pe(e2), t2 = [r, e2.ext ?? false, e2.key_ops ?? n2], i2 = { ...e2 };
  return delete i2.alg, delete i2.use, w.subtle.importKey("jwk", i2, ...t2);
}, "Ce"), ue = Ce;
var oe = /* @__PURE__ */ __name((e2) => x(e2), "oe"), N, q, ce = /* @__PURE__ */ __name((e2) => (e2 == null ? void 0 : e2[Symbol.toStringTag]) === "KeyObject", "ce"), le = /* @__PURE__ */ __name(async (e2, r, n2, t2) => {
  let i2 = e2.get(r);
  if (i2 == null ? void 0 : i2[t2]) return i2[t2];
  let s = await ue({ ...n2, alg: t2 });
  return i2 ? i2[t2] = s : e2.set(r, { [t2]: s }), s;
}, "le"), Oe = /* @__PURE__ */ __name((e2, r) => {
  if (ce(e2)) {
    let n2 = e2.export({ format: "jwk" });
    return delete n2.d, delete n2.dp, delete n2.dq, delete n2.p, delete n2.q, delete n2.qi, n2.k ? oe(n2.k) : (q || (q = /* @__PURE__ */ new WeakMap()), le(q, e2, n2, r));
  }
  return e2;
}, "Oe"), Te = /* @__PURE__ */ __name((e2, r) => {
  if (ce(e2)) {
    let n2 = e2.export({ format: "jwk" });
    return n2.k ? oe(n2.k) : (N || (N = /* @__PURE__ */ new WeakMap()), le(N, e2, n2, r));
  }
  return e2;
}, "Te"), L = { normalizePublicKey: Oe, normalizePrivateKey: Te };
var S = /* @__PURE__ */ __name((e2) => e2 == null ? void 0 : e2[Symbol.toStringTag], "S"), We = /* @__PURE__ */ __name((e2, r) => {
  if (!(r instanceof Uint8Array)) {
    if (!J(r)) throw new TypeError(M(e2, r, ...A, "Uint8Array"));
    if (r.type !== "secret") throw new TypeError(`${S(r)} instances for symmetric algorithms must be of type "secret"`);
  }
}, "We"), Ke = /* @__PURE__ */ __name((e2, r, n2) => {
  if (!J(r)) throw new TypeError(M(e2, r, ...A));
  if (r.type === "secret") throw new TypeError(`${S(r)} instances for asymmetric algorithms must not be of type "secret"`);
  if (n2 === "sign" && r.type === "public") throw new TypeError(`${S(r)} instances for asymmetric algorithm signing must be of type "private"`);
  if (n2 === "decrypt" && r.type === "public") throw new TypeError(`${S(r)} instances for asymmetric algorithm decryption must be of type "private"`);
  if (r.algorithm && n2 === "verify" && r.type === "private") throw new TypeError(`${S(r)} instances for asymmetric algorithm verifying must be of type "public"`);
  if (r.algorithm && n2 === "encrypt" && r.type === "private") throw new TypeError(`${S(r)} instances for asymmetric algorithm encryption must be of type "public"`);
}, "Ke"), je = /* @__PURE__ */ __name((e2, r, n2) => {
  e2.startsWith("HS") || e2 === "dir" || e2.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e2) ? We(e2, r) : Ke(e2, r, n2);
}, "je"), fe = je;
function Me(e2, r, n2, t2, i2) {
  if (i2.crit !== void 0 && (t2 == null ? void 0 : t2.crit) === void 0) throw new e2('"crit" (Critical) Header Parameter MUST be integrity protected');
  if (!t2 || t2.crit === void 0) return /* @__PURE__ */ new Set();
  if (!Array.isArray(t2.crit) || t2.crit.length === 0 || t2.crit.some((u2) => typeof u2 != "string" || u2.length === 0)) throw new e2('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
  let s;
  n2 !== void 0 ? s = new Map([...Object.entries(n2), ...r.entries()]) : s = r;
  for (let u2 of t2.crit) {
    if (!s.has(u2)) throw new m(`Extension Header Parameter "${u2}" is not recognized`);
    if (i2[u2] === void 0) throw new e2(`Extension Header Parameter "${u2}" is missing`);
    if (s.get(u2) && t2[u2] === void 0) throw new e2(`Extension Header Parameter "${u2}" MUST be integrity protected`);
  }
  return new Set(t2.crit);
}
__name(Me, "Me");
var ae = Me;
function H(e2, r) {
  let n2 = `SHA-${e2.slice(-3)}`;
  switch (e2) {
    case "HS256":
    case "HS384":
    case "HS512":
      return { hash: n2, name: "HMAC" };
    case "PS256":
    case "PS384":
    case "PS512":
      return { hash: n2, name: "RSA-PSS", saltLength: e2.slice(-3) >> 3 };
    case "RS256":
    case "RS384":
    case "RS512":
      return { hash: n2, name: "RSASSA-PKCS1-v1_5" };
    case "ES256":
    case "ES384":
    case "ES512":
      return { hash: n2, name: "ECDSA", namedCurve: r.namedCurve };
    case "EdDSA":
      return { name: r.name };
    default:
      throw new m(`alg ${e2} is not supported either by JOSE or your javascript runtime`);
  }
}
__name(H, "H");
async function G(e2, r, n2) {
  if (r = await L.normalizePublicKey(r, e2), R(r)) return ne(r, e2, n2), r;
  if (r instanceof Uint8Array) {
    if (!e2.startsWith("HS")) throw new TypeError(j(r, ...A));
    return w.subtle.importKey("raw", r, { hash: `SHA-${e2.slice(-3)}`, name: "HMAC" }, false, [n2]);
  }
  throw new TypeError(j(r, ...A, "Uint8Array"));
}
__name(G, "G");
var Ne = /* @__PURE__ */ __name(async (e2, r, n2, t2) => {
  let i2 = await G(e2, r, "verify");
  se(e2, i2);
  let s = H(e2, i2.algorithm);
  try {
    return await w.subtle.verify(s, i2, n2, t2);
  } catch {
    return false;
  }
}, "Ne"), ye = Ne;
async function he(e2, r, n2) {
  if (!k(e2)) throw new l("Flattened JWS must be an object");
  if (e2.protected === void 0 && e2.header === void 0) throw new l('Flattened JWS must have either of the "protected" or "header" members');
  if (e2.protected !== void 0 && typeof e2.protected != "string") throw new l("JWS Protected Header incorrect type");
  if (e2.payload === void 0) throw new l("JWS Payload missing");
  if (typeof e2.signature != "string") throw new l("JWS Signature missing or incorrect type");
  if (e2.header !== void 0 && !k(e2.header)) throw new l("JWS Unprotected Header incorrect type");
  let t2 = {};
  if (e2.protected) try {
    let W = x(e2.protected);
    t2 = JSON.parse(d.decode(W));
  } catch {
    throw new l("JWS Protected Header is invalid");
  }
  if (!ie(t2, e2.header)) throw new l("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
  let i2 = { ...t2, ...e2.header }, s = ae(l, /* @__PURE__ */ new Map([["b64", true]]), n2 == null ? void 0 : n2.crit, t2, i2), u2 = true;
  if (s.has("b64") && (u2 = t2.b64, typeof u2 != "boolean")) throw new l('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
  let { alg: o2 } = i2;
  if (typeof o2 != "string" || !o2) throw new l('JWS "alg" (Algorithm) Header Parameter missing or invalid');
  if (u2) {
    if (typeof e2.payload != "string") throw new l("JWS Payload must be a string");
  } else if (typeof e2.payload != "string" && !(e2.payload instanceof Uint8Array)) throw new l("JWS Payload must be a string or an Uint8Array instance");
  let f = false;
  typeof r == "function" && (r = await r(t2, e2), f = true), fe(o2, r, "verify");
  let y2 = re(g.encode(e2.protected ?? ""), g.encode("."), typeof e2.payload == "string" ? g.encode(e2.payload) : e2.payload), v;
  try {
    v = x(e2.signature);
  } catch {
    throw new l("Failed to base64url decode the signature");
  }
  if (!await ye(o2, r, v, y2)) throw new P();
  let E;
  if (u2) try {
    E = x(e2.payload);
  } catch {
    throw new l("Failed to base64url decode the payload");
  }
  else typeof e2.payload == "string" ? E = g.encode(e2.payload) : E = e2.payload;
  let h = { payload: E };
  return e2.protected !== void 0 && (h.protectedHeader = t2), e2.header !== void 0 && (h.unprotectedHeader = e2.header), f ? { ...h, key: r } : h;
}
__name(he, "he");
async function me(e2, r, n2) {
  if (e2 instanceof Uint8Array && (e2 = d.decode(e2)), typeof e2 != "string") throw new l("Compact JWS must be a string or Uint8Array");
  let { 0: t2, 1: i2, 2: s, length: u2 } = e2.split(".");
  if (u2 !== 3) throw new l("Invalid Compact JWS");
  let o2 = await he({ payload: i2, protected: t2, signature: s }, r, n2), c2 = { payload: o2.payload, protectedHeader: o2.protectedHeader };
  return typeof r == "function" ? { ...c2, key: o2.key } : c2;
}
__name(me, "me");
var ve = /* @__PURE__ */ __name((e2) => Math.floor(e2.getTime() / 1e3), "ve");
var qe = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, U = /* @__PURE__ */ __name((e2) => {
  let r = qe.exec(e2);
  if (!r || r[4] && r[1]) throw new TypeError("Invalid time period format");
  let n2 = parseFloat(r[2]), t2 = r[3].toLowerCase(), i2;
  switch (t2) {
    case "sec":
    case "secs":
    case "second":
    case "seconds":
    case "s":
      i2 = Math.round(n2);
      break;
    case "minute":
    case "minutes":
    case "min":
    case "mins":
    case "m":
      i2 = Math.round(n2 * 60);
      break;
    case "hour":
    case "hours":
    case "hr":
    case "hrs":
    case "h":
      i2 = Math.round(n2 * 3600);
      break;
    case "day":
    case "days":
    case "d":
      i2 = Math.round(n2 * 86400);
      break;
    case "week":
    case "weeks":
    case "w":
      i2 = Math.round(n2 * 604800);
      break;
    default:
      i2 = Math.round(n2 * 31557600);
      break;
  }
  return r[1] === "-" || r[4] === "ago" ? -i2 : i2;
}, "U");
var de = /* @__PURE__ */ __name((e2) => e2.toLowerCase().replace(/^application\//, ""), "de"), Le = /* @__PURE__ */ __name((e2, r) => typeof e2 == "string" ? r.includes(e2) : Array.isArray(e2) ? r.some(Set.prototype.has.bind(new Set(e2))) : false, "Le"), _e = /* @__PURE__ */ __name((e2, r, n2 = {}) => {
  let t2;
  try {
    t2 = JSON.parse(d.decode(r));
  } catch {
  }
  if (!k(t2)) throw new a("JWT Claims Set must be a top-level JSON object");
  let { typ: i2 } = n2;
  if (i2 && (typeof e2.typ != "string" || de(e2.typ) !== de(i2))) throw new p('unexpected "typ" JWT header value', t2, "typ", "check_failed");
  let { requiredClaims: s = [], issuer: u2, subject: o2, audience: c2, maxTokenAge: f } = n2, y2 = [...s];
  f !== void 0 && y2.push("iat"), c2 !== void 0 && y2.push("aud"), o2 !== void 0 && y2.push("sub"), u2 !== void 0 && y2.push("iss");
  for (let h of new Set(y2.reverse())) if (!(h in t2)) throw new p(`missing required "${h}" claim`, t2, h, "missing");
  if (u2 && !(Array.isArray(u2) ? u2 : [u2]).includes(t2.iss)) throw new p('unexpected "iss" claim value', t2, "iss", "check_failed");
  if (o2 && t2.sub !== o2) throw new p('unexpected "sub" claim value', t2, "sub", "check_failed");
  if (c2 && !Le(t2.aud, typeof c2 == "string" ? [c2] : c2)) throw new p('unexpected "aud" claim value', t2, "aud", "check_failed");
  let v;
  switch (typeof n2.clockTolerance) {
    case "string":
      v = U(n2.clockTolerance);
      break;
    case "number":
      v = n2.clockTolerance;
      break;
    case "undefined":
      v = 0;
      break;
    default:
      throw new TypeError("Invalid clockTolerance option type");
  }
  let { currentDate: ee } = n2, E = ve(ee || /* @__PURE__ */ new Date());
  if ((t2.iat !== void 0 || f) && typeof t2.iat != "number") throw new p('"iat" claim must be a number', t2, "iat", "invalid");
  if (t2.nbf !== void 0) {
    if (typeof t2.nbf != "number") throw new p('"nbf" claim must be a number', t2, "nbf", "invalid");
    if (t2.nbf > E + v) throw new p('"nbf" claim timestamp check failed', t2, "nbf", "check_failed");
  }
  if (t2.exp !== void 0) {
    if (typeof t2.exp != "number") throw new p('"exp" claim must be a number', t2, "exp", "invalid");
    if (t2.exp <= E - v) throw new I('"exp" claim timestamp check failed', t2, "exp", "check_failed");
  }
  if (f) {
    let h = E - t2.iat, W = typeof f == "number" ? f : U(f);
    if (h - v > W) throw new I('"iat" claim timestamp check failed (too far in the past)', t2, "iat", "check_failed");
    if (h < 0 - v) throw new p('"iat" claim timestamp check failed (it should be in the past)', t2, "iat", "check_failed");
  }
  return t2;
}, "_e");
async function z$1(e2, r, n2) {
  var _a2;
  let t2 = await me(e2, r, n2);
  if (((_a2 = t2.protectedHeader.crit) == null ? void 0 : _a2.includes("b64")) && t2.protectedHeader.b64 === false) throw new a("JWTs MUST NOT use unencoded payload");
  let s = { payload: _e(t2.protectedHeader, t2.payload, n2), protectedHeader: t2.protectedHeader };
  return typeof r == "function" ? { ...s, key: t2.key } : s;
}
__name(z$1, "z$1");
var be = x;
function V(e2) {
  if (typeof e2 != "string") throw new a("JWTs must use Compact JWS serialization, JWT must be a string");
  let { 1: r, length: n2 } = e2.split(".");
  if (n2 === 5) throw new a("Only JWTs using Compact JWS serialization can be decoded");
  if (n2 !== 3) throw new a("Invalid JWT");
  if (!r) throw new a("JWTs must contain a payload");
  let t2;
  try {
    t2 = be(r);
  } catch {
    throw new a("Failed to base64url decode the payload");
  }
  let i2;
  try {
    i2 = JSON.parse(d.decode(t2));
  } catch {
    throw new a("Failed to parse the decoded payload as JSON");
  }
  if (!k(i2)) throw new a("Invalid JWT Claims Set");
  return i2;
}
__name(V, "V");
function O(e2) {
  var r = new Error(e2);
  return r.source = "ulid", r;
}
__name(O, "O");
var X = "0123456789ABCDEFGHJKMNPQRSTVWXYZ", D = X.length, xe = Math.pow(2, 48) - 1, Ge = 10, Ue = 16;
function ze(e2) {
  var r = Math.floor(e2() * D);
  return r === D && (r = D - 1), X.charAt(r);
}
__name(ze, "ze");
function Ve(e2, r) {
  if (isNaN(e2)) throw new Error(e2 + " must be a number");
  if (e2 > xe) throw O("cannot encode time greater than " + xe);
  if (e2 < 0) throw O("time must be positive");
  if (Number.isInteger(e2) === false) throw O("time must be an integer");
  for (var n2 = void 0, t2 = ""; r > 0; r--) n2 = e2 % D, t2 = X.charAt(n2) + t2, e2 = (e2 - n2) / D;
  return t2;
}
__name(Ve, "Ve");
function Xe(e2, r) {
  for (var n2 = ""; e2 > 0; e2--) n2 = ze(r) + n2;
  return n2;
}
__name(Xe, "Xe");
function Fe() {
  var e2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false, r = arguments[1];
  r || (r = typeof window < "u" ? window : null);
  var n2 = r && (r.crypto || r.msCrypto);
  if (n2) return function() {
    var i2 = new Uint8Array(1);
    return n2.getRandomValues(i2), i2[0] / 255;
  };
  try {
    var t2 = Ee();
    return function() {
      return t2.randomBytes(1).readUInt8() / 255;
    };
  } catch {
  }
  if (e2) {
    try {
      console.error("secure crypto unusable, falling back to insecure Math.random()!");
    } catch {
    }
    return function() {
      return Math.random();
    };
  }
  throw O("secure crypto unusable, insecure Math.random not allowed");
}
__name(Fe, "Fe");
function Be(e2) {
  return e2 || (e2 = Fe()), function(n2) {
    return isNaN(n2) && (n2 = Date.now()), Ve(n2, Ge) + Xe(Ue, e2);
  };
}
__name(Be, "Be");
Be();
var Ze;
function Qe(e2) {
  return Ze == null ? void 0 : Ze.get(e2);
}
__name(Qe, "Qe");
var er;
function rr(e2) {
  return er == null ? void 0 : er.get(e2);
}
__name(rr, "rr");
var nr;
function tr(e2, r) {
  var _a2;
  return (_a2 = nr == null ? void 0 : nr.get(e2)) == null ? void 0 : _a2.get(r);
}
__name(tr, "tr");
function ir(e2) {
  var _a2, _b2;
  let r = typeof e2;
  return r === "string" ? `"${e2}"` : r === "number" || r === "bigint" || r === "boolean" ? `${e2}` : r === "object" || r === "function" ? (e2 && ((_b2 = (_a2 = Object.getPrototypeOf(e2)) == null ? void 0 : _a2.constructor) == null ? void 0 : _b2.name)) ?? "null" : r;
}
__name(ir, "ir");
function T(e2, r, n2, t2, i2) {
  let s = i2 && "input" in i2 ? i2.input : n2.value, u2 = (i2 == null ? void 0 : i2.expected) ?? e2.expects ?? null, o2 = (i2 == null ? void 0 : i2.received) ?? ir(s), c2 = { kind: e2.kind, type: e2.type, input: s, expected: u2, received: o2, message: `Invalid ${r}: ${u2 ? `Expected ${u2} but r` : "R"}eceived ${o2}`, requirement: e2.requirement, path: i2 == null ? void 0 : i2.path, issues: i2 == null ? void 0 : i2.issues, lang: t2.lang, abortEarly: t2.abortEarly, abortPipeEarly: t2.abortPipeEarly }, f = e2.kind === "schema", y2 = (i2 == null ? void 0 : i2.message) ?? e2.message ?? tr(e2.reference, c2.lang) ?? (f ? rr(c2.lang) : null) ?? t2.message ?? Qe(c2.lang);
  y2 && (c2.message = typeof y2 == "function" ? y2(c2) : y2), f && (n2.typed = false), n2.issues ? n2.issues.push(c2) : n2.issues = [c2];
}
__name(T, "T");
function F(e2) {
  return { kind: "transformation", type: "brand", reference: F, async: false, name: e2, _run(r) {
    return r;
  } };
}
__name(F, "F");
function sr(e2, r, n2) {
  return typeof e2.default == "function" ? e2.default(r, n2) : e2.default;
}
__name(sr, "sr");
function B(e2) {
  return { kind: "schema", type: "number", reference: B, expects: "number", async: false, message: e2, _run(r, n2) {
    return typeof r.value == "number" && !isNaN(r.value) ? r.typed = true : T(this, "type", r, n2), r;
  } };
}
__name(B, "B");
function Y(e2, ...r) {
  let n2 = { kind: "schema", type: "optional", reference: Y, expects: `${e2.expects} | undefined`, async: false, wrapped: e2, _run(t2, i2) {
    return t2.value === void 0 && ("default" in this && (t2.value = sr(this, t2, i2)), t2.value === void 0) ? (t2.typed = true, t2) : this.wrapped._run(t2, i2);
  } };
  return 0 in r && (n2.default = r[0]), n2;
}
__name(Y, "Y");
function Z(e2, r) {
  return { kind: "schema", type: "strict_object", reference: Z, expects: "Object", async: false, entries: e2, message: r, _run(n2, t2) {
    var _a2;
    let i2 = n2.value;
    if (i2 && typeof i2 == "object") {
      n2.typed = true, n2.value = {};
      for (let s in this.entries) {
        let u2 = i2[s], o2 = this.entries[s]._run({ typed: false, value: u2 }, t2);
        if (o2.issues) {
          let c2 = { type: "object", origin: "value", input: i2, key: s, value: u2 };
          for (let f of o2.issues) f.path ? f.path.unshift(c2) : f.path = [c2], (_a2 = n2.issues) == null ? void 0 : _a2.push(f);
          if (n2.issues || (n2.issues = o2.issues), t2.abortEarly) {
            n2.typed = false;
            break;
          }
        }
        o2.typed || (n2.typed = false), (o2.value !== void 0 || s in i2) && (n2.value[s] = o2.value);
      }
      if (!n2.issues || !t2.abortEarly) {
        for (let s in i2) if (!(s in this.entries)) {
          let u2 = i2[s];
          T(this, "type", n2, t2, { input: u2, expected: "never", path: [{ type: "object", origin: "value", input: i2, key: s, value: u2 }] });
          break;
        }
      }
    } else T(this, "type", n2, t2);
    return n2;
  } };
}
__name(Z, "Z");
function Q(e2) {
  return { kind: "schema", type: "string", reference: Q, expects: "string", async: false, message: e2, _run(r, n2) {
    return typeof r.value == "string" ? r.typed = true : T(this, "type", r, n2), r;
  } };
}
__name(Q, "Q");
function ke(...e2) {
  return { ...e2[0], pipe: e2, _run(r, n2) {
    for (let t2 of e2) if (t2.kind !== "metadata") {
      if (r.issues && (t2.kind === "schema" || t2.kind === "transformation")) {
        r.typed = false;
        break;
      }
      (!r.issues || !n2.abortEarly && !n2.abortPipeEarly) && (r = t2._run(r, n2));
    }
    return r;
  } };
}
__name(ke, "ke");
var or = ke(Q(), F("lid"));
Z({ id: or, ver: Y(B()) });
var cr = /* @__PURE__ */ __name((e2) => () => e2 * 48271 % 2147483647 / 2147483647, "cr"), lr = /* @__PURE__ */ __name((e2) => typeof Buffer < "u" ? Buffer.from(e2).toString("base64") : btoa(typeof e2 == "string" ? e2 : String.fromCharCode(...e2)), "lr"), fr = /* @__PURE__ */ __name((e2) => typeof Buffer < "u" ? Buffer.from(e2, "base64").toString() : atob(e2), "fr"), ar = /* @__PURE__ */ __name((e2, r) => {
  let n2 = cr(r), i2 = new TextEncoder().encode(e2).map((s) => s ^ Math.floor(n2() * 256));
  return lr(i2);
}, "ar"), pr = /* @__PURE__ */ __name((e2) => e2.split("").reverse().join(""), "pr");
var yr = /* @__PURE__ */ __name((e2) => typeof e2 == "object" && !!e2 && "sub" in e2 && "exp" in e2 && typeof e2.sub == "string" && typeof e2.exp == "number", "yr"), hr = /* @__PURE__ */ __name(async (e2) => {
  let r = pr(fr(e2));
  return { decoded: V(r), jwt: r };
}, "hr"), mr = /* @__PURE__ */ __name(async (e2) => {
  let { decoded: r, jwt: n2 } = await hr(e2);
  if (!yr(r)) throw new Error("Invalid license key");
  let { sub: t2, exp: i2 } = r, s = new TextEncoder().encode(ar(t2, i2));
  return await z$1(n2, s), r;
}, "mr");
function ReExtTrial({ reextkey, version: version2, daysleft, setDaysLeft }) {
  const [trialtype, setTrialType] = useState(null);
  const [closedialog, setCloseDialog] = useState(false);
  useEffect(() => {
    const getReExtKeyInfo = /* @__PURE__ */ __name(async (reextkey2) => {
      if (reextkey2 === void 0) {
        return { type: "nokey", daysleft: 0 };
      }
      if (reextkey2.toLowerCase().includes("testkey")) {
        return { type: "trial", daysleft: 10 };
      }
      if (reextkey2.toLowerCase().includes("expiredkey")) {
        return { type: "expired", daysleft: 0 };
      }
      try {
        const payload = await mr(reextkey2);
        const timestampdate = new Date(payload.exp * 1e3);
        const today = /* @__PURE__ */ new Date();
        const differenceInMilliseconds = timestampdate - today;
        const differenceInDays = Math.floor(
          differenceInMilliseconds / (1e3 * 60 * 60 * 24)
        );
        if (differenceInDays > 0) {
          return { type: "trial", daysleft: differenceInDays };
        } else {
          return { type: "expired", daysleft: 0 };
        }
      } catch (e2) {
        if (e2.message.includes("claim timestamp check failed")) {
          return { type: "expired", daysleft: 0 };
        } else {
          return { type: "invalidkey", daysleft: 0 };
        }
      }
    }, "getReExtKeyInfo");
    const doAsync = /* @__PURE__ */ __name(async () => {
      var result = await getReExtKeyInfo(reextkey);
      setTrialType(result.type);
      setDaysLeft(result.daysleft);
      if (window) {
        window.dl = result.daysleft;
      }
    }, "doAsync");
    doAsync();
  }, []);
  if (closedialog === true) {
    return null;
  }
  if (trialtype === "trial" && daysleft > 0) {
    return null;
  }
  if (trialtype !== null) {
    return /* @__PURE__ */ jsx(
      "div",
      {
        style: {
          zIndex: 2e5,
          fontSize: "22px",
          background: "rgb(211,211,211,.4)",
          color: "black",
          display: "flex",
          flexDirection: "column",
          position: "absolute",
          left: "50%",
          width: "100%",
          height: "100%",
          transform: "translateX(-50%)",
          padding: "10px 10px 10px 10px",
          border: "1px solid black"
        },
        children: /* @__PURE__ */ jsxs(
          "div",
          {
            style: {
              height: "100%",
              display: "flex",
              padding: "10px 10px 10px 10px",
              flexDirection: "column",
              margin: "40px",
              borderRadius: "5px",
              border: "1px solid gray",
              background: "white"
            },
            children: [
              /* @__PURE__ */ jsxs(
                "div",
                {
                  style: {
                    display: "flex",
                    flexDirection: "row",
                    alignItems: "center"
                  },
                  children: [
                    /* @__PURE__ */ jsx("img", { style: { width: 160 }, src: "../ReExt/ReExt.png" }),
                    /* @__PURE__ */ jsxs("div", { style: { margin: "0 0 0 20px" }, children: [
                      "Welcome to the ReExt v",
                      version2,
                      " Trial"
                    ] })
                  ]
                }
              ),
              trialtype === "nokey" && /* @__PURE__ */ jsxs(Fragment, { children: [
                /* @__PURE__ */ jsxs("div", { style: { margin: "10px 0 10px 0", fontSize: "18px" }, children: [
                  "This is a 30 day trial version of ReExt.",
                  /* @__PURE__ */ jsx("br", {}),
                  "Without a valid trial key, this dialog will appear.",
                  /* @__PURE__ */ jsx("br", {}),
                  /* @__PURE__ */ jsx("br", {}),
                  "To have a trial key emailed to you, fill in this form and click 'Get Trial Key'."
                ] }),
                /* @__PURE__ */ jsx(
                  "div",
                  {
                    style: {
                      xwidth: "100%",
                      flex: 1,
                      display: "flex",
                      border: "0px solid red"
                    },
                    children: /* @__PURE__ */ jsx(
                      "iframe",
                      {
                        style: {
                          width: "100%",
                          margin: "0 0 10px 0",
                          flex: 1,
                          border: "0px solid lightgray"
                        },
                        src: "https://www.sencha.com/forms/reext/trial-reext.php"
                      }
                    )
                  }
                ),
                /* @__PURE__ */ jsxs(
                  "div",
                  {
                    style: {
                      display: "flex",
                      flexDirection: "row",
                      justifyContent: "space-between",
                      alignItems: "flex-end"
                    },
                    children: [
                      /* @__PURE__ */ jsx("div", { style: { fontSize: "12px" }, children: trialtype }),
                      /* @__PURE__ */ jsx(
                        "button",
                        {
                          style: { fontSize: "18px", padding: "5px 5px 5px 5px" },
                          onClick: /* @__PURE__ */ __name(() => {
                            setCloseDialog(true);
                          }, "onClick"),
                          children: "Close"
                        }
                      )
                    ]
                  }
                )
              ] }),
              trialtype === "expired" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
                "div",
                {
                  style: {
                    display: "flex",
                    flexDirection: "column",
                    justifyContent: "center",
                    alignItems: "center",
                    margin: "10px 0 10px 0",
                    fontSize: "18px",
                    height: "100%"
                  },
                  children: [
                    /* @__PURE__ */ jsx("div", { style: { margin: "0 0 20px 0", fontSize: "24px" }, children: "Your ReExt trial key has expired" }),
                    /* @__PURE__ */ jsx("div", { children: "Contact Sencha Sales" }),
                    /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
                      "a",
                      {
                        href: "https://www.sencha.com/company/contact/",
                        target: "_blank",
                        rel: "noopener noreferrer",
                        children: "https://www.sencha.com/company/contact/"
                      }
                    ) })
                  ]
                }
              ) }),
              trialtype === "invalidkey" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
                "div",
                {
                  style: {
                    display: "flex",
                    flexDirection: "column",
                    justifyContent: "center",
                    alignItems: "center",
                    margin: "10px 0 10px 0",
                    fontSize: "18px",
                    height: "100%"
                  },
                  children: [
                    /* @__PURE__ */ jsx("div", { style: { margin: "0 0 20px 0", fontSize: "24px" }, children: "Your ReExt trial key is invalid" }),
                    /* @__PURE__ */ jsx("div", { children: "Contact Sencha Sales" }),
                    /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
                      "a",
                      {
                        href: "https://www.sencha.com/company/contact/",
                        target: "_blank",
                        rel: "noopener noreferrer",
                        children: "https://www.sencha.com/company/contact/"
                      }
                    ) })
                  ]
                }
              ) })
            ]
          }
        )
      }
    );
  }
}
__name(ReExtTrial, "ReExtTrial");
function ReExtPlugin() {
  return /* @__PURE__ */ jsxs(
    "div",
    {
      style: {
        padding: "30px",
        boxSizing: "border-box",
        flexDirection: "column",
        //alignItems: "center",
        //justifyContent: "center",
        height: "90vh",
        //width: "100vw",
        fontSize: 24,
        fontWeight: "bold",
        color: "black"
      },
      children: [
        /* @__PURE__ */ jsx("div", { style: { margin: "0 0 10px 0" }, children: "A ReExt plugin is needed to run this ReExt app" }),
        /* @__PURE__ */ jsx("div", { style: { margin: "30px 0 0 0" }, children: "For Vite, modify vite.config.js like this:" }),
        /* @__PURE__ */ jsx("pre", { style: { fontSize: "18px", color: "green", textAlign: "left" }, children: `import { defineConfig } from 'vite';

import reext from './node_modules/@sencha/reext/dist/ReExt/vite-plugin-reext.js';
export default defineConfig({
  plugins: [
    
    reext()
  ]
})` }),
        /* @__PURE__ */ jsx("div", { children: "For Next.js, modify next.config.mjs like this:" }),
        /* @__PURE__ */ jsx("pre", { style: { fontSize: "18px", color: "green", textAlign: "left" }, children: `/** @type {import('next').NextConfig} */
import withReExtPlugin from './node_modules/@sencha/reext/dist/ReExt/next-plugin-reext.js';
const nextConfig = {};
export default withReExtPlugin(nextConfig);` })
      ]
    }
  );
}
__name(ReExtPlugin, "ReExtPlugin");
async function z(t2) {
  if (!(typeof window === void 0 || typeof window > "u")) try {
    let P2 = /* @__PURE__ */ __name(async (e2, x2, d2) => new Promise((y2) => {
      window.Ext.onReady(function() {
        return window.Ext.ReExtLocation = d2, window.Ext.ReExtTheme = e2, window.Ext.ReExtLi = true, y2(1);
      });
    }), "P"), w2 = /* @__PURE__ */ __name(async (e2) => typeof window === void 0 || typeof window > "u" ? void 0 : new Promise((d2, j2) => {
      let y2 = document.getElementsByTagName("HEAD")[0];
      var E = false;
      for (let v = 0; v < y2.childNodes.length; v++) y2.childNodes[v].src === e2 && (E = true);
      if (E === false) {
        let v = document.createElement("script");
        v.src = e2, y2.appendChild(v), v.addEventListener("load", () => {
          if (window.Ext === void 0) return d2(1);
          window.Ext.onReady(function() {
            return d2(1);
          });
        }), v.addEventListener("error", () => {
          var l2 = `${e2} (js)

 - did you download the SDK from the support portal?
 - are you trying to download a file without an enterprise license?
 - do you have debug: true for ReExtData in a production build?`;
          console.error(l2), j2(l2);
        });
      }
    }), "w"), r = /* @__PURE__ */ __name(async (e2) => typeof window === void 0 || typeof window > "u" ? void 0 : new Promise((d2, j2) => {
      let y2 = document.getElementsByTagName("HEAD")[0];
      var E = false;
      for (let l2 = 0; l2 < y2.childNodes.length; l2++) {
        let m2 = y2.childNodes[l2];
        var v = window.location.origin + "/" + e2;
        m2.href === e2 && (E = true);
      }
      if (E === false) {
        let l2 = document.createElement("link");
        l2.rel = "stylesheet", l2.type = "text/css", l2.href = e2, y2.appendChild(l2), l2.addEventListener("load", () => {
          if (window.Ext === void 0) return c, d2(1);
          window.Ext.onReady(function() {
            return d2(1);
          });
        }), l2.addEventListener("error", () => {
          var m2 = `${e2} (css)

                - did you download the SDK from the support portal?
                - are you trying to download a file without an enterprise license?`;
          return console.error(m2), j2(m2);
        });
      }
    }), "r");
    var a2 = t2.toolkit;
    (a2 == null || a2 === "") && (a2 = "modern");
    var s = t2.theme;
    (s == null || s === "") && (s = "material");
    var f = t2.packages;
    f === void 0 && (f = { charts: false, fontawesome: false, ux: false, calendar: false, d3: false, exporter: false, pivot: false, pivotd3: false, pivotlocale: false, froalaeditor: false });
    var i2 = t2.debug, T2 = t2.license, K2 = t2.urlbase, S2 = t2.location;
    (S2 === "remote" || S2 === null) && (K2 = "https://cdn.sencha.com/reext/ext/");
    var N2 = t2.rtl;
    N2 === false || N2 === void 0 ? N2 = "" : N2 = "-rtl";
    var C2 = t2.locale;
    C2 === void 0 && (C2 = "en");
    var u2 = t2.sdkversion;
    switch (u2) {
      case "7.0.0":
        u2 = u2 + ".156";
        break;
      case "7.1.0":
        u2 = u2 + ".46";
        break;
      case "7.2.0":
      case "7.3.0":
      case "7.3.1":
      case "7.4.0":
      case "7.5.0":
      case "7.5.1":
      case "7.6.0":
      case "7.7.0":
      case "7.8.0":
      case "7.9.0":
        break;
      default:
        throw `SDK version ${u2} is not valid`;
    }
    var A2 = K2 + "ext-" + u2, n2 = K2 + "ext-addons-" + u2;
    i2 === true ? i2 = "-debug" : i2 = "";
    var B2 = "";
    a2 === "modern" && (B2 = "-modern");
    var F2 = ["ios", "material", "neptune", "triton"];
    if (a2 === "modern" && !F2.includes(s)) throw `${s} theme is not in ${a2} toolkit for SDK version ${u2}`;
    var I2 = ["classic", "crisp", "graphite", "gray", "material", "neptune", "triton"];
    a2 === "classic" && !I2.includes(s) && console.warn(`${s} is a custom theme in ${a2} toolkit for SDK version ${u2}`);
    var H2 = false;
    (f.calendar === true || f.d3 === true || f.exporter === true || f.pivot === true || f.pivotd3 === true || f.pivotlocale === true || f.froalaeditor === true) && (H2 = true);
    var o2 = A2 + "/build";
    if (u2.slice(-1) === "c") {
      await w2(`${o2}/ext-${u2}-toolkit-${a2}-sdk.js`), await r(`${o2}/ext-${u2}-theme-${s}-sdk.css`), H2 === true && (await w2(`${A2}/ext-${u2}-toolkit-${a2}-addons.js`), await r(`${A2}/ext-${u2}-theme-${s}-addons.css`)), await P2(s, T2, S2);
      return;
    }
    var q2 = await w2(`${o2}/ext${B2}-all${N2}${i2}.js`);
    if (await r(`${o2}/${a2}/theme-${s}/resources/theme-${s}-all${N2}.css`), f.fontawesome === true && await r(`${o2}/packages/font-awesome/resources/font-awesome-all${i2}.css`), await w2(`${o2}/${a2}/locale/locale-${C2}${i2}.js`), f.ux === true && (await w2(`${o2}/packages/ux/${a2}/ux${i2}.js`), u2 === "7.0.0" && a2 === "modern" && s === "neptune" && await r(`${o2}/packages/ux/${a2}/${a2}-${s}/resources/ux-all${i2}.css`), u2 === "7.0.0" && a2 === "classic" && await r(`${o2}/packages/ux/${a2}/${s}/resources/ux-all${i2}.css`), u2 !== "7.0.0" && a2 === "classic" && s === "material" && await r(`${o2}/packages/ux/${a2}/${a2}-${s}/resources/ux-all${i2}.css`), u2 !== "7.0.0" && a2 === "classic" && s !== "material" && s !== "gray" && await r(`${o2}/packages/ux/${a2}/${s}/resources/ux-all${i2}.css`)), f.charts === true) {
      await w2(`${o2}/packages/charts/${a2}/charts${i2}.js`);
      var O2 = true;
      (a2 === "modern" && s === "ios" && u2 === "7.0.0" || s === "gray") && (O2 = false), O2 === true && (a2 === "classic" && s !== "material" ? await r(`${o2}/packages/charts/${a2}/${s}/resources/charts-all${i2}.css`) : await r(`${o2}/packages/charts/${a2}/${a2}-${s}/resources/charts-all${i2}.css`));
    }
    if (H2 === true) {
      var $;
      n2 = n2 + "/packages", f.calendar === true && ($ = "calendar", await w2(`${n2}/${$}/build/${a2}/${$}${i2}.js`), a2 === "modern" && s === "ios" || u2 === "7.0.0.156" ? await r(`${n2}/${$}/build/${a2}/${s}/resources/${$}-all${i2}.css`) : s !== "gray" && s !== "graphite" && (a2 === "classic" && s !== "material" ? await r(`${n2}/${$}/build/${a2}/${s}/resources/${$}-all${i2}.css`) : await r(`${n2}/${$}/build/${a2}/${a2}-${s}/resources/${$}-all${i2}.css`))), f.d3 === true && ($ = "d3", await w2(`${n2}/${$}/build/${a2}/${$}${i2}.js`), await w2(`ReExt/${$}-debug-overrides-component.js`), a2 === "modern" && (s === "ios" || s === "material") ? await r(`${n2}/${$}/build/${a2}/${s}/resources/${$}-all${i2}.css`) : s !== "gray" && s !== "graphite" && (a2 === "classic" && s !== "material" ? await r(`${n2}/${$}/build/${a2}/${s}/resources/${$}-all${i2}.css`) : await r(`${n2}/${$}/build/${a2}/${a2}-${s}/resources/${$}-all${i2}.css`))), f.exporter === true && ($ = "exporter", await w2(`${n2}/${$}/build/${a2}/${$}${i2}.js`), await r(`${n2}/${$}/build/${a2}/resources/${$}-all${i2}.css`)), f.pivot === true && ($ = "pivot", await w2(`${n2}/${$}/build/${a2}/${$}${i2}.js`), a2 === "modern" && (s === "ios" || s === "material") ? await r(`${n2}/${$}/build/${a2}/${s}/resources/${$}-all${i2}.css`) : s !== "gray" && s !== "graphite" && (a2 === "classic" && s !== "material" ? await r(`${n2}/${$}/build/${a2}/${s}/resources/${$}-all${i2}.css`) : await r(`${n2}/${$}/build/${a2}/${a2}-${s}/resources/${$}-all${i2}.css`))), f.pivotd3 === true && ($ = "pivot-d3", await w2(`${n2}/${$}/build/${a2}/${$}${i2}.js`), a2 === "modern" && (s === "ios" || s === "material") ? await r(`${n2}/${$}/build/${a2}/${s}/resources/${$}-all${i2}.css`) : s !== "gray" && s !== "graphite" && (a2 === "classic" && s !== "material" ? await r(`${n2}/${$}/build/${a2}/${s}/resources/${$}-all${i2}.css`) : await r(`${n2}/${$}/build/${a2}/${a2}-${s}/resources/${$}-all${i2}.css`))), f.froalaeditor === true && ($ = "froala-editor", await w2(`${n2}/${$}/build/${a2}/${$}${i2}.js`), await r(`${n2}/${$}/build/${a2}/${s}/resources/${$}-all${i2}.css`), await w2(`${n2}/${$}/development/froalaeditor.pkgd.js`), await r(`${n2}/${$}/development/froalaeditor.pkgd.css`)), f.pivotlocale;
    }
    async function J2(e2) {
      var x2 = e2.location;
      if (x2 === "local") {
        var d2 = e2.overrides;
        if (d2 === void 0 && (d2 = false), d2 !== true && (d2 = false), d2 === true) {
          var j2 = `${e2.urlbase}ext-${e2.sdkversion}/${a2}overrides.js`;
          async function E(v) {
            try {
              let l2 = await fetch(v, { method: "HEAD" });
              return l2.status === 404 ? (console.error("ReExtData.overrides is true but no overrides file exists"), false) : l2.status === 200;
            } catch {
              return false;
            }
          }
          __name(E, "E");
          var y2 = await E(j2);
          y2 && await w2(j2);
        }
      }
    }
    __name(J2, "J");
    if (await J2(t2), t2.debug === true) try {
      await w2("node_modules/@sencha/reext/dist/ReExt/debug.js");
    } catch (e2) {
      console.warn("debug not loaded... " + e2.toString());
    }
    async function _2(e2, x2) {
      if (e2 !== void 0 && x2 !== void 0) for (let d2 of x2) {
        let j2 = `${window.location.origin}/${e2}/${d2}`;
        await w2(j2);
      }
    }
    __name(_2, "_");
    await _2(t2.customfolder, t2.customfiles), await P2(s, T2, S2);
  } catch {
    console.log("fail");
  }
}
__name(z, "z");
if (typeof window !== void 0 && typeof window !== "undefined") {
  window.tt = "trial";
  window.dl = 0;
}
function ReExtProvider({ children, ReExtData, reextkey, splash }) {
  if (typeof window === void 0 || typeof window === "undefined") {
    return;
  }
  const [ready, setReady] = useState(false);
  const [type, setType] = useState(null);
  const [daysleft, setDaysLeft] = useState(null);
  const [reextplugin, setReExtPlugin] = useState(null);
  useEffect(() => {
    if (typeof window === void 0 || typeof window === "undefined") {
      return;
    }
    if (window.tt === "production" || window.location.host === "reextdemo.vercel.app" || reextkey !== void 0 && reextkey.toLowerCase().includes("ehsug")) {
      setType("production");
      window.tt = "production";
    } else {
      setType("trial");
      window.tt = "trial";
    }
    try {
      if (window.next !== void 0) {
        setReExtPlugin(true);
        return;
      }
      var r = window.__IS_REEXT_RUNNING__;
      if (r === void 0) {
        setReExtPlugin(false);
      } else {
        setReExtPlugin(true);
      }
    } catch (e2) {
      console.error("Vite or Next.js plugin not installed");
      setReExtPlugin(false);
    }
  }, []);
  try {
    useEffect(() => {
      if (typeof window === void 0 || typeof window === "undefined") {
        return;
      }
      const doAsync = /* @__PURE__ */ __name(async () => {
        var ReExtDataDefault = {
          sdkversion: "7.8.0",
          toolkit: "classic",
          theme: "classic",
          packages: {
            charts: false,
            fontawesome: false,
            ux: false,
            calendar: false,
            d3: false,
            exporter: false,
            pivot: false,
            pivotd3: false,
            pivotlocale: false,
            froalaeditor: false
          },
          rtl: false,
          locale: "en",
          debug: false,
          urlbase: "./",
          location: "remote",
          overrides: false
        };
        if (ReExtData === void 0) {
          ReExtData = ReExtDataDefault;
        }
        try {
          await z(ReExtData);
          setReady(true);
        } catch (e2) {
          console.error("fail", e2);
        }
      }, "doAsync");
      doAsync();
    }, []);
    if (!ready) {
      if (splash === true || splash === "true") {
        return /* @__PURE__ */ jsx(ReExtSplash, {});
      } else {
        return null;
      }
    }
    if (ready && type !== null) {
      return /* @__PURE__ */ jsxs(Fragment, { children: [
        window.tt !== "production" && /* @__PURE__ */ jsx(
          ReExtTrial,
          {
            reextkey,
            version,
            daysleft,
            setDaysLeft
          }
        ),
        reextplugin === false && /* @__PURE__ */ jsx(ReExtPlugin, {}),
        reextplugin === true && children
      ] });
    }
  } catch (e2) {
    return /* @__PURE__ */ jsx("div", { children: e2.toString() });
  }
}
__name(ReExtProvider, "ReExtProvider");
const useReExtState = /* @__PURE__ */ __name((init) => {
  if (typeof window === void 0 || typeof window === "undefined") {
    return;
  }
  const [s, setS] = useState(init);
  var sRef = useRef();
  sRef.current = s;
  const getS = /* @__PURE__ */ __name(() => {
    return sRef.current;
  }, "getS");
  return [getS, setS];
}, "useReExtState");
function ReExtReferences(obj) {
  if (typeof window === void 0 || typeof window === "undefined") {
    return;
  }
  var refs;
  var c2 = obj.getController();
  var parent = obj;
  while (c2 === void 0) {
    c2 = obj.parent.getController();
    parent = obj.parent;
  }
  refs = c2.getReferences();
  if (refs === null) {
    refs = {};
  }
  if (parent.ReExtChildren !== void 0) {
    for (var i2 = 0; i2 < parent.ReExtChildren.length; i2++) {
      if (parent.ReExtChildren[i2].reference !== null) {
        refs[parent.ReExtChildren[i2].reference] = parent.ReExtChildren[i2];
      }
    }
  }
  return refs;
}
__name(ReExtReferences, "ReExtReferences");
function doReExt(xtype, props) {
  var newprops = { ...props };
  if (props.config === void 0) {
    newprops.config = {};
  }
  if (props.style === void 0) {
    newprops.style = {};
  }
  Object.entries(newprops).forEach(([key, value]) => {
    switch (key) {
      case "rootClassName":
        newprops.className = value;
        break;
      case "rootStyle":
        newprops.style = value;
        break;
      case "region":
        delete newprops.region;
        newprops.childRegion = value;
        break;
      case "childFlex":
        newprops.flex = value;
        newprops.style.flex = value;
        break;
      case "flex":
        newprops.style.flex = value;
        newprops.childFlex = value;
        break;
      default:
        if (!/^on[A-Z]/.test(key) && key !== "region" && key !== "xtype" && key !== "ready" && key !== "config" && key !== "storeloaded") {
          newprops.config[key] = value;
        }
    }
  });
  return /* @__PURE__ */ jsx(ReExt, { xtype, ...newprops, children: props.children });
}
__name(doReExt, "doReExt");
function ReExtBreadCrumb(props) {
  return doReExt("breadcrumb", props);
}
__name(ReExtBreadCrumb, "ReExtBreadCrumb");
function ReExtButton(props) {
  useEffect(() => {
  }, [props]);
  return doReExt("button", props);
}
__name(ReExtButton, "ReExtButton");
function ReExtCycleButton(props) {
  return doReExt("cycle", props);
}
__name(ReExtCycleButton, "ReExtCycleButton");
function ReExtSegmentedButton(props) {
  return doReExt("segmentedbutton", props);
}
__name(ReExtSegmentedButton, "ReExtSegmentedButton");
function ReExtSplitButton(props) {
  return doReExt("splitbutton", props);
}
__name(ReExtSplitButton, "ReExtSplitButton");
function ReExtFileButton(props) {
  return doReExt("filebutton", props);
}
__name(ReExtFileButton, "ReExtFileButton");
function ReExtColorButton(props) {
  return doReExt("colorbutton", props);
}
__name(ReExtColorButton, "ReExtColorButton");
function ReExtCalendar(props) {
  return doReExt("calendar", props);
}
__name(ReExtCalendar, "ReExtCalendar");
function ReExtCalendarPicker(props) {
  return doReExt("calendar-calendar-picker", props);
}
__name(ReExtCalendarPicker, "ReExtCalendarPicker");
function ReExtCalendarDay(props) {
  return doReExt("calendar-day", props);
}
__name(ReExtCalendarDay, "ReExtCalendarDay");
function ReExtCalendarDays(props) {
  return doReExt("calendar-days", props);
}
__name(ReExtCalendarDays, "ReExtCalendarDays");
function ReExtCalendarMonth(props) {
  return doReExt("calendar-month", props);
}
__name(ReExtCalendarMonth, "ReExtCalendarMonth");
function ReExtCalendarWeek(props) {
  return doReExt("calendar-week", props);
}
__name(ReExtCalendarWeek, "ReExtCalendarWeek");
function ReExtCalendarWeeks(props) {
  return doReExt("calendar-weeks", props);
}
__name(ReExtCalendarWeeks, "ReExtCalendarWeeks");
function ReExtChart(props) {
  return doReExt("chart", props);
}
__name(ReExtChart, "ReExtChart");
function ReExtCheckboxField(props) {
  return doReExt("checkboxfield", props);
}
__name(ReExtCheckboxField, "ReExtCheckboxField");
function ReExtColorField(props) {
  return doReExt("colorfield", props);
}
__name(ReExtColorField, "ReExtColorField");
function ReExtColorPicker(props) {
  return doReExt("colorpicker", props);
}
__name(ReExtColorPicker, "ReExtColorPicker");
function ReExtComboboxField(props) {
  return doReExt("comboboxfield", props);
}
__name(ReExtComboboxField, "ReExtComboboxField");
function ReExtContainer(props) {
  return doReExt("container", props);
}
__name(ReExtContainer, "ReExtContainer");
function ReExtD3HeatMap(props) {
  return doReExt("d3-heatmap", props);
}
__name(ReExtD3HeatMap, "ReExtD3HeatMap");
function ReExtD3HorizontalTree(props) {
  return doReExt("d3-horizontal-tree", props);
}
__name(ReExtD3HorizontalTree, "ReExtD3HorizontalTree");
function ReExtD3Pack(props) {
  return doReExt("d3-pack", props);
}
__name(ReExtD3Pack, "ReExtD3Pack");
function ReExtD3Sunburst(props) {
  return doReExt("d3-sunburst", props);
}
__name(ReExtD3Sunburst, "ReExtD3Sunburst");
function ReExtD3Tree(props) {
  return doReExt("d3-tree", props);
}
__name(ReExtD3Tree, "ReExtD3Tree");
function ReExtDateField(props) {
  return doReExt("datefield", props);
}
__name(ReExtDateField, "ReExtDateField");
function ReExtDatePicker(props) {
  return doReExt("datepicker", props);
}
__name(ReExtDatePicker, "ReExtDatePicker");
function ReExtDisplayField(props) {
  return doReExt("displayfield", props);
}
__name(ReExtDisplayField, "ReExtDisplayField");
function ReExtFileField(props) {
  return doReExt("filefield", props);
}
__name(ReExtFileField, "ReExtFileField");
function ReExtFroalaEditorField(props) {
  return doReExt("froalaeditorfield", props);
}
__name(ReExtFroalaEditorField, "ReExtFroalaEditorField");
function ReExtGrid(props) {
  return doReExt("grid", props);
}
__name(ReExtGrid, "ReExtGrid");
function ReExtGuage(props) {
  return doReExt("guage", props);
}
__name(ReExtGuage, "ReExtGuage");
function ReExtHtmlEditor(props) {
  return doReExt("htmleditor", props);
}
__name(ReExtHtmlEditor, "ReExtHtmlEditor");
function ReExtImage(props) {
  return doReExt("image", props);
}
__name(ReExtImage, "ReExtImage");
function ReExtLabel(props) {
  return doReExt("label", props);
}
__name(ReExtLabel, "ReExtLabel");
function ReExtMonthPicker(props) {
  return doReExt("monthpicker", props);
}
__name(ReExtMonthPicker, "ReExtMonthPicker");
function ReExtMultiSelectField(props) {
  return doReExt("multiselectfield", props);
}
__name(ReExtMultiSelectField, "ReExtMultiSelectField");
function ReExtNumberField(props) {
  return doReExt("numberfield", props);
}
__name(ReExtNumberField, "ReExtNumberField");
function ReExtPanel(props) {
  return doReExt("panel", props);
}
__name(ReExtPanel, "ReExtPanel");
function ReExtPickerField(props) {
  return doReExt("pickerfield", props);
}
__name(ReExtPickerField, "ReExtPickerField");
function ReExtPivotGrid(props) {
  return doReExt("pivotgrid", props);
}
__name(ReExtPivotGrid, "ReExtPivotGrid");
function ReExtPivotTreeMap(props) {
  return doReExt("pivottreemap", props);
}
__name(ReExtPivotTreeMap, "ReExtPivotTreeMap");
function ReExtPivotheatmap(props) {
  return doReExt("pivotheatmap", props);
}
__name(ReExtPivotheatmap, "ReExtPivotheatmap");
function ReExtRadioField(props) {
  return doReExt("radiofield", props);
}
__name(ReExtRadioField, "ReExtRadioField");
function ReExtRating(props) {
  return doReExt("rating", props);
}
__name(ReExtRating, "ReExtRating");
function ReExtSearchField(props) {
  return doReExt("searchfield", props);
}
__name(ReExtSearchField, "ReExtSearchField");
function ReExtSliderField(props) {
  return doReExt("sliderfield", props);
}
__name(ReExtSliderField, "ReExtSliderField");
function ReExtTagField(props) {
  return doReExt("tagfield", props);
}
__name(ReExtTagField, "ReExtTagField");
function ReExtTextAreaField(props) {
  return doReExt("textareafield", props);
}
__name(ReExtTextAreaField, "ReExtTextAreaField");
function ReExtTextField(props) {
  return doReExt("textfield", props);
}
__name(ReExtTextField, "ReExtTextField");
function ReExtTimeField(props) {
  return doReExt("timefield", props);
}
__name(ReExtTimeField, "ReExtTimeField");
function ReExtTimePicker(props) {
  return doReExt("timepicker", props);
}
__name(ReExtTimePicker, "ReExtTimePicker");
function ReExtTreelist(props) {
  return doReExt("treelist", props);
}
__name(ReExtTreelist, "ReExtTreelist");
function ReExtTreePicker(props) {
  return doReExt("treepicker", props);
}
__name(ReExtTreePicker, "ReExtTreePicker");
function ReExtTriggerField(props) {
  return doReExt("triggerfield", props);
}
__name(ReExtTriggerField, "ReExtTriggerField");
export {
  e as Fill,
  ReExtBreadCrumb,
  ReExtButton,
  ReExtCalendar,
  ReExtCalendarDay,
  ReExtCalendarDays,
  ReExtCalendarMonth,
  ReExtCalendarPicker,
  ReExtCalendarWeek,
  ReExtCalendarWeeks,
  ReExtChart,
  ReExtCheckboxField,
  ReExtColorButton,
  ReExtColorField,
  ReExtColorPicker,
  ReExtComboboxField,
  ReExtContainer,
  ReExtCycleButton,
  ReExtD3HeatMap,
  ReExtD3HorizontalTree,
  ReExtD3Pack,
  ReExtD3Sunburst,
  ReExtD3Tree,
  ReExtDateField,
  ReExtDatePicker,
  ReExtDisplayField,
  ReExtFileButton,
  ReExtFileField,
  ReExtFroalaEditorField,
  ReExtGrid,
  ReExtGuage,
  ReExtHtmlEditor,
  ReExtImage,
  ReExtLabel,
  ReExtMonthPicker,
  ReExtMultiSelectField,
  ReExtNumberField,
  ReExtPanel,
  ReExtPickerField,
  ReExtPivotGrid,
  ReExtPivotTreeMap,
  ReExtPivotheatmap,
  ReExtProvider,
  ReExtRadioField,
  ReExtRating,
  ReExtReferences,
  ReExtSearchField,
  ReExtSegmentedButton,
  ReExtSliderField,
  ReExtSplitButton,
  ReExtTagField,
  ReExtTextAreaField,
  ReExtTextField,
  ReExtTimeField,
  ReExtTimePicker,
  ReExtTreePicker,
  ReExtTreelist,
  ReExtTriggerField,
  ReExt as default,
  useReExtState
};
