Greasy Fork

爱问答助手

全平台问答助手,一键获取整个页面的试题答案,目前支持【超星学习通】,更多平台开发中...

目前为 2024-04-15 提交的版本。查看 最新版本

// ==UserScript==
// @name         爱问答助手
// @namespace    aiask/askHelper
// @version      1.0.1
// @author       aiask
// @description  全平台问答助手,一键获取整个页面的试题答案,目前支持【超星学习通】,更多平台开发中...
// @license      MIT
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAAXNSR0IArs4c6QAAAHVQTFRFR3BMgICBQD8/QUVHQ0ZIRUhKX2FiQD8/Tk1NP0VJPzs7Pz8/QD4+UE9QQD8/PVlnQD8/M6vj////n5+fN5C60NDQSl9qOXWSZL/qTFNXzOr4QWl8yMjItLS02traOIOnNZzN6OfnlJeZ9/f3PYGgpdrzmdXxgSBJqQAAABB0Uk5TAP5E6vys+7/Q0RhsfPFV/OwFarYAAAEESURBVHjapdHrboMgGIBhUHBaD/sAlTE8VOt2/5c4GlBMRZOl7w8j+kQQ0FaVwbG48IDq+piMPcgkO1bD/8DXvhD4/fb9ePDuGiqa2krV7pO1AxSLYIl2ABoeTLSvYMBi4N0sphOAlVaqg1aTPggmZYYaFvNMBYGQz6G6m2vbhEBvF81MxALFTDpbQQd3ZhvBgxqiFfBEO/CJ7ZxkNPcUbWBwn5DJw4KSsJHcHPCTLLDuQxpLkiMLbAIWJs1wBRVkyAFXT7Sa+AYQjTywNfOD74DNA18I9Ifjpg7Es/3Jj5eKyIEcBgNwhk5L8XMPonMQQcfNhBfRpIfbFbiRskCX5enFyz/07TSN9vGxKwAAAABJRU5ErkJggg==
// @match        *://*.chaoxing.com/*
// @require      https://cdn.bootcdn.net/ajax/libs/vue/3.4.21/vue.global.prod.js
// @require      https://cdn.bootcdn.net/ajax/libs/vue-demi/0.14.6/index.iife.js
// @require      data:application/javascript,%3Bwindow.Vue%3DVue%3B
// @require      https://cdn.bootcdn.net/ajax/libs/element-plus/2.6.3/index.full.min.js
// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js
// @resource     ElementPlus  https://cdn.bootcdn.net/ajax/libs/element-plus/2.6.3/index.min.css
// @resource     ttf          https://www.forestpolice.org/ttf/2.0/table.json
// @connect      127.0.0.1
// @connect      62.234.36.191
// @connect      icodef.com
// @connect      muketool.com
// @grant        GM_addStyle
// @grant        GM_getResourceText
// @grant        GM_getValue
// @grant        GM_info
// @grant        GM_setValue
// @grant        GM_xmlhttpRequest
// @grant        unsafeWindow
// @run-at       document-start
// ==/UserScript==

(e=>{if(typeof GM_addStyle=="function"){GM_addStyle(e);return}const o=document.createElement("style");o.textContent=e,document.head.append(o)})(" button[data-v-e40e424a]{margin:10px}.el-row{margin-bottom:20px}.el-row:last-child{margin-bottom:0}.el-col{border-radius:4px}.grid-content{border-radius:4px;min-height:36px}.aah_btn{width:100%}.aah_title img{max-width:100%;height:auto;overflow:hidden}.aah_title{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;margin-bottom:10px}.aah_active{box-shadow:0 0 5px #0af}.aah_bomHet50{padding:13px 0 13px 10px}.aah_bomHet50 span{display:inline-block;line-height:24px;padding-left:14px;color:#a8a8b3}.aah_bomHet50 span i{display:inline-block;width:10px;height:10px;border:1px solid #DBDFE9;border-radius:2px;vertical-align:middle;margin-right:4px;margin-top:-2px}.aah_bomHet50 .dq i{background-color:#ecf5ff;box-shadow:0 0 5px #0af}.aah_bomHet50 .yp i{background-color:#f0f9eb;border-color:#409eff}.aah_bomHet50 .wp i{background-color:#fef0f0;border-color:#f56c6c}.wrapper>div{pointer-events:none}.wrapper>div>div{pointer-events:none}.el-dialog{pointer-events:auto}.minimized-dialog img{pointer-events:auto;width:50px!important;z-index:100;position:fixed;bottom:0;right:0}.aah_breadcrumb{margin-bottom:20px} ");

(function (vue, $, ElementPlus) {
  'use strict';

  var __defProp = Object.defineProperty;
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  var __publicField = (obj, key, value) => {
    __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
    return value;
  };
  var _GM_getResourceText = /* @__PURE__ */ (() => typeof GM_getResourceText != "undefined" ? GM_getResourceText : void 0)();
  var _GM_getValue = /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)();
  var _GM_info = /* @__PURE__ */ (() => typeof GM_info != "undefined" ? GM_info : void 0)();
  var _GM_setValue = /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)();
  var _GM_xmlhttpRequest = /* @__PURE__ */ (() => typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : void 0)();
  var _unsafeWindow = /* @__PURE__ */ (() => typeof unsafeWindow != "undefined" ? unsafeWindow : void 0)();
  var isVue2 = false;
  /*!
   * pinia v2.1.7
   * (c) 2023 Eduardo San Martin Morote
   * @license MIT
   */
  let activePinia;
  const setActivePinia = (pinia) => activePinia = pinia;
  const piniaSymbol = (
    /* istanbul ignore next */
    Symbol()
  );
  function isPlainObject(o) {
    return o && typeof o === "object" && Object.prototype.toString.call(o) === "[object Object]" && typeof o.toJSON !== "function";
  }
  var MutationType;
  (function(MutationType2) {
    MutationType2["direct"] = "direct";
    MutationType2["patchObject"] = "patch object";
    MutationType2["patchFunction"] = "patch function";
  })(MutationType || (MutationType = {}));
  function createPinia() {
    const scope = vue.effectScope(true);
    const state = scope.run(() => vue.ref({}));
    let _p = [];
    let toBeInstalled = [];
    const pinia = vue.markRaw({
      install(app) {
        setActivePinia(pinia);
        {
          pinia._a = app;
          app.provide(piniaSymbol, pinia);
          app.config.globalProperties.$pinia = pinia;
          toBeInstalled.forEach((plugin) => _p.push(plugin));
          toBeInstalled = [];
        }
      },
      use(plugin) {
        if (!this._a && !isVue2) {
          toBeInstalled.push(plugin);
        } else {
          _p.push(plugin);
        }
        return this;
      },
      _p,
      // it's actually undefined here
      // @ts-expect-error
      _a: null,
      _e: scope,
      _s: /* @__PURE__ */ new Map(),
      state
    });
    return pinia;
  }
  const noop = () => {
  };
  function addSubscription(subscriptions, callback, detached, onCleanup = noop) {
    subscriptions.push(callback);
    const removeSubscription = () => {
      const idx = subscriptions.indexOf(callback);
      if (idx > -1) {
        subscriptions.splice(idx, 1);
        onCleanup();
      }
    };
    if (!detached && vue.getCurrentScope()) {
      vue.onScopeDispose(removeSubscription);
    }
    return removeSubscription;
  }
  function triggerSubscriptions(subscriptions, ...args) {
    subscriptions.slice().forEach((callback) => {
      callback(...args);
    });
  }
  const fallbackRunWithContext = (fn) => fn();
  function mergeReactiveObjects(target, patchToApply) {
    if (target instanceof Map && patchToApply instanceof Map) {
      patchToApply.forEach((value, key) => target.set(key, value));
    }
    if (target instanceof Set && patchToApply instanceof Set) {
      patchToApply.forEach(target.add, target);
    }
    for (const key in patchToApply) {
      if (!patchToApply.hasOwnProperty(key))
        continue;
      const subPatch = patchToApply[key];
      const targetValue = target[key];
      if (isPlainObject(targetValue) && isPlainObject(subPatch) && target.hasOwnProperty(key) && !vue.isRef(subPatch) && !vue.isReactive(subPatch)) {
        target[key] = mergeReactiveObjects(targetValue, subPatch);
      } else {
        target[key] = subPatch;
      }
    }
    return target;
  }
  const skipHydrateSymbol = (
    /* istanbul ignore next */
    Symbol()
  );
  function shouldHydrate(obj) {
    return !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);
  }
  const { assign } = Object;
  function isComputed(o) {
    return !!(vue.isRef(o) && o.effect);
  }
  function createOptionsStore(id, options, pinia, hot) {
    const { state, actions, getters } = options;
    const initialState = pinia.state.value[id];
    let store;
    function setup() {
      if (!initialState && true) {
        {
          pinia.state.value[id] = state ? state() : {};
        }
      }
      const localState = vue.toRefs(pinia.state.value[id]);
      return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => {
        computedGetters[name] = vue.markRaw(vue.computed(() => {
          setActivePinia(pinia);
          const store2 = pinia._s.get(id);
          return getters[name].call(store2, store2);
        }));
        return computedGetters;
      }, {}));
    }
    store = createSetupStore(id, setup, options, pinia, hot, true);
    return store;
  }
  function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {
    let scope;
    const optionsForPlugin = assign({ actions: {} }, options);
    const $subscribeOptions = {
      deep: true
      // flush: 'post',
    };
    let isListening;
    let isSyncListening;
    let subscriptions = [];
    let actionSubscriptions = [];
    let debuggerEvents;
    const initialState = pinia.state.value[$id];
    if (!isOptionsStore && !initialState && true) {
      {
        pinia.state.value[$id] = {};
      }
    }
    vue.ref({});
    let activeListener;
    function $patch(partialStateOrMutator) {
      let subscriptionMutation;
      isListening = isSyncListening = false;
      if (typeof partialStateOrMutator === "function") {
        partialStateOrMutator(pinia.state.value[$id]);
        subscriptionMutation = {
          type: MutationType.patchFunction,
          storeId: $id,
          events: debuggerEvents
        };
      } else {
        mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);
        subscriptionMutation = {
          type: MutationType.patchObject,
          payload: partialStateOrMutator,
          storeId: $id,
          events: debuggerEvents
        };
      }
      const myListenerId = activeListener = Symbol();
      vue.nextTick().then(() => {
        if (activeListener === myListenerId) {
          isListening = true;
        }
      });
      isSyncListening = true;
      triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);
    }
    const $reset = isOptionsStore ? function $reset2() {
      const { state } = options;
      const newState = state ? state() : {};
      this.$patch(($state) => {
        assign($state, newState);
      });
    } : (
      /* istanbul ignore next */
      noop
    );
    function $dispose() {
      scope.stop();
      subscriptions = [];
      actionSubscriptions = [];
      pinia._s.delete($id);
    }
    function wrapAction(name, action) {
      return function() {
        setActivePinia(pinia);
        const args = Array.from(arguments);
        const afterCallbackList = [];
        const onErrorCallbackList = [];
        function after(callback) {
          afterCallbackList.push(callback);
        }
        function onError(callback) {
          onErrorCallbackList.push(callback);
        }
        triggerSubscriptions(actionSubscriptions, {
          args,
          name,
          store,
          after,
          onError
        });
        let ret;
        try {
          ret = action.apply(this && this.$id === $id ? this : store, args);
        } catch (error) {
          triggerSubscriptions(onErrorCallbackList, error);
          throw error;
        }
        if (ret instanceof Promise) {
          return ret.then((value) => {
            triggerSubscriptions(afterCallbackList, value);
            return value;
          }).catch((error) => {
            triggerSubscriptions(onErrorCallbackList, error);
            return Promise.reject(error);
          });
        }
        triggerSubscriptions(afterCallbackList, ret);
        return ret;
      };
    }
    const partialStore = {
      _p: pinia,
      // _s: scope,
      $id,
      $onAction: addSubscription.bind(null, actionSubscriptions),
      $patch,
      $reset,
      $subscribe(callback, options2 = {}) {
        const removeSubscription = addSubscription(subscriptions, callback, options2.detached, () => stopWatcher());
        const stopWatcher = scope.run(() => vue.watch(() => pinia.state.value[$id], (state) => {
          if (options2.flush === "sync" ? isSyncListening : isListening) {
            callback({
              storeId: $id,
              type: MutationType.direct,
              events: debuggerEvents
            }, state);
          }
        }, assign({}, $subscribeOptions, options2)));
        return removeSubscription;
      },
      $dispose
    };
    const store = vue.reactive(partialStore);
    pinia._s.set($id, store);
    const runWithContext = pinia._a && pinia._a.runWithContext || fallbackRunWithContext;
    const setupStore = runWithContext(() => pinia._e.run(() => (scope = vue.effectScope()).run(setup)));
    for (const key in setupStore) {
      const prop = setupStore[key];
      if (vue.isRef(prop) && !isComputed(prop) || vue.isReactive(prop)) {
        if (!isOptionsStore) {
          if (initialState && shouldHydrate(prop)) {
            if (vue.isRef(prop)) {
              prop.value = initialState[key];
            } else {
              mergeReactiveObjects(prop, initialState[key]);
            }
          }
          {
            pinia.state.value[$id][key] = prop;
          }
        }
      } else if (typeof prop === "function") {
        const actionValue = wrapAction(key, prop);
        {
          setupStore[key] = actionValue;
        }
        optionsForPlugin.actions[key] = prop;
      } else
        ;
    }
    {
      assign(store, setupStore);
      assign(vue.toRaw(store), setupStore);
    }
    Object.defineProperty(store, "$state", {
      get: () => pinia.state.value[$id],
      set: (state) => {
        $patch(($state) => {
          assign($state, state);
        });
      }
    });
    pinia._p.forEach((extender) => {
      {
        assign(store, scope.run(() => extender({
          store,
          app: pinia._a,
          pinia,
          options: optionsForPlugin
        })));
      }
    });
    if (initialState && isOptionsStore && options.hydrate) {
      options.hydrate(store.$state, initialState);
    }
    isListening = true;
    isSyncListening = true;
    return store;
  }
  function defineStore(idOrOptions, setup, setupOptions) {
    let id;
    let options;
    const isSetupStore = typeof setup === "function";
    if (typeof idOrOptions === "string") {
      id = idOrOptions;
      options = isSetupStore ? setupOptions : setup;
    } else {
      options = idOrOptions;
      id = idOrOptions.id;
    }
    function useStore(pinia, hot) {
      const hasContext = vue.hasInjectionContext();
      pinia = // in test mode, ignore the argument provided as we can always retrieve a
      // pinia instance with getActivePinia()
      pinia || (hasContext ? vue.inject(piniaSymbol, null) : null);
      if (pinia)
        setActivePinia(pinia);
      pinia = activePinia;
      if (!pinia._s.has(id)) {
        if (isSetupStore) {
          createSetupStore(id, setup, options, pinia);
        } else {
          createOptionsStore(id, options, pinia);
        }
      }
      const store = pinia._s.get(id);
      return store;
    }
    useStore.$id = id;
    return useStore;
  }
  const prefix = "AiAsk_";
  class Cache {
    /**
     * 封装缓存
     * @param key 缓存key
     * @param value 缓存值
     * @param expire 过期时间
     * 
     * @returns 缓存值
     */
    static set(key, value, expire = 0) {
      key = prefix + key;
      if (expire > 0) {
        _GM_setValue(key, {
          value,
          expire: (/* @__PURE__ */ new Date()).getTime() + expire * 1e3
        });
      } else {
        _GM_setValue(key, {
          value,
          expire: 0
        });
      }
      return _GM_getValue(key);
    }
    /**
     * 获取缓存
     * @param key 缓存key
     * 
     * @returns 缓存值
     */
    static get(key, defaultVal = null) {
      key = prefix + key;
      let cache = _GM_getValue(key);
      if (cache && cache.expire > 0 && cache.expire < (/* @__PURE__ */ new Date()).getTime()) {
        _GM_setValue(key, null);
        return defaultVal;
      }
      return cache ? cache.value : defaultVal;
    }
  }
  /*! @license DOMPurify 3.0.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.11/LICENSE */
  const {
    entries,
    setPrototypeOf,
    isFrozen,
    getPrototypeOf,
    getOwnPropertyDescriptor
  } = Object;
  let {
    freeze,
    seal,
    create
  } = Object;
  let {
    apply,
    construct
  } = typeof Reflect !== "undefined" && Reflect;
  if (!freeze) {
    freeze = function freeze2(x) {
      return x;
    };
  }
  if (!seal) {
    seal = function seal2(x) {
      return x;
    };
  }
  if (!apply) {
    apply = function apply2(fun, thisValue, args) {
      return fun.apply(thisValue, args);
    };
  }
  if (!construct) {
    construct = function construct2(Func, args) {
      return new Func(...args);
    };
  }
  const arrayForEach = unapply(Array.prototype.forEach);
  const arrayPop = unapply(Array.prototype.pop);
  const arrayPush = unapply(Array.prototype.push);
  const stringToLowerCase = unapply(String.prototype.toLowerCase);
  const stringToString = unapply(String.prototype.toString);
  const stringMatch = unapply(String.prototype.match);
  const stringReplace = unapply(String.prototype.replace);
  const stringIndexOf = unapply(String.prototype.indexOf);
  const stringTrim = unapply(String.prototype.trim);
  const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
  const regExpTest = unapply(RegExp.prototype.test);
  const typeErrorCreate = unconstruct(TypeError);
  function unapply(func) {
    return function(thisArg) {
      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        args[_key - 1] = arguments[_key];
      }
      return apply(func, thisArg, args);
    };
  }
  function unconstruct(func) {
    return function() {
      for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
        args[_key2] = arguments[_key2];
      }
      return construct(func, args);
    };
  }
  function addToSet(set, array) {
    let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
    if (setPrototypeOf) {
      setPrototypeOf(set, null);
    }
    let l = array.length;
    while (l--) {
      let element = array[l];
      if (typeof element === "string") {
        const lcElement = transformCaseFunc(element);
        if (lcElement !== element) {
          if (!isFrozen(array)) {
            array[l] = lcElement;
          }
          element = lcElement;
        }
      }
      set[element] = true;
    }
    return set;
  }
  function cleanArray(array) {
    for (let index = 0; index < array.length; index++) {
      const isPropertyExist = objectHasOwnProperty(array, index);
      if (!isPropertyExist) {
        array[index] = null;
      }
    }
    return array;
  }
  function clone(object) {
    const newObject = create(null);
    for (const [property, value] of entries(object)) {
      const isPropertyExist = objectHasOwnProperty(object, property);
      if (isPropertyExist) {
        if (Array.isArray(value)) {
          newObject[property] = cleanArray(value);
        } else if (value && typeof value === "object" && value.constructor === Object) {
          newObject[property] = clone(value);
        } else {
          newObject[property] = value;
        }
      }
    }
    return newObject;
  }
  function lookupGetter(object, prop) {
    while (object !== null) {
      const desc = getOwnPropertyDescriptor(object, prop);
      if (desc) {
        if (desc.get) {
          return unapply(desc.get);
        }
        if (typeof desc.value === "function") {
          return unapply(desc.value);
        }
      }
      object = getPrototypeOf(object);
    }
    function fallbackValue() {
      return null;
    }
    return fallbackValue;
  }
  const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
  const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
  const svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]);
  const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]);
  const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]);
  const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
  const text = freeze(["#text"]);
  const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]);
  const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
  const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
  const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
  const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
  const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
  const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
  const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/);
  const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
  const IS_ALLOWED_URI = seal(
    /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
    // eslint-disable-line no-useless-escape
  );
  const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
  const ATTR_WHITESPACE = seal(
    /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
    // eslint-disable-line no-control-regex
  );
  const DOCTYPE_NAME = seal(/^html$/i);
  const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
  var EXPRESSIONS = /* @__PURE__ */ Object.freeze({
    __proto__: null,
    MUSTACHE_EXPR,
    ERB_EXPR,
    TMPLIT_EXPR,
    DATA_ATTR,
    ARIA_ATTR,
    IS_ALLOWED_URI,
    IS_SCRIPT_OR_DATA,
    ATTR_WHITESPACE,
    DOCTYPE_NAME,
    CUSTOM_ELEMENT
  });
  const getGlobal = function getGlobal2() {
    return typeof window === "undefined" ? null : window;
  };
  const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
    if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
      return null;
    }
    let suffix = null;
    const ATTR_NAME = "data-tt-policy-suffix";
    if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
      suffix = purifyHostElement.getAttribute(ATTR_NAME);
    }
    const policyName = "dompurify" + (suffix ? "#" + suffix : "");
    try {
      return trustedTypes.createPolicy(policyName, {
        createHTML(html2) {
          return html2;
        },
        createScriptURL(scriptUrl) {
          return scriptUrl;
        }
      });
    } catch (_) {
      console.warn("TrustedTypes policy " + policyName + " could not be created.");
      return null;
    }
  };
  function createDOMPurify() {
    let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
    const DOMPurify = (root) => createDOMPurify(root);
    DOMPurify.version = "3.0.11";
    DOMPurify.removed = [];
    if (!window2 || !window2.document || window2.document.nodeType !== 9) {
      DOMPurify.isSupported = false;
      return DOMPurify;
    }
    let {
      document: document2
    } = window2;
    const originalDocument = document2;
    const currentScript = originalDocument.currentScript;
    const {
      DocumentFragment,
      HTMLTemplateElement,
      Node,
      Element,
      NodeFilter,
      NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap,
      HTMLFormElement,
      DOMParser: DOMParser2,
      trustedTypes
    } = window2;
    const ElementPrototype = Element.prototype;
    const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
    const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
    const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
    const getParentNode = lookupGetter(ElementPrototype, "parentNode");
    if (typeof HTMLTemplateElement === "function") {
      const template = document2.createElement("template");
      if (template.content && template.content.ownerDocument) {
        document2 = template.content.ownerDocument;
      }
    }
    let trustedTypesPolicy;
    let emptyHTML = "";
    const {
      implementation,
      createNodeIterator,
      createDocumentFragment,
      getElementsByTagName
    } = document2;
    const {
      importNode
    } = originalDocument;
    let hooks = {};
    DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
    const {
      MUSTACHE_EXPR: MUSTACHE_EXPR2,
      ERB_EXPR: ERB_EXPR2,
      TMPLIT_EXPR: TMPLIT_EXPR2,
      DATA_ATTR: DATA_ATTR2,
      ARIA_ATTR: ARIA_ATTR2,
      IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2,
      ATTR_WHITESPACE: ATTR_WHITESPACE2,
      CUSTOM_ELEMENT: CUSTOM_ELEMENT2
    } = EXPRESSIONS;
    let {
      IS_ALLOWED_URI: IS_ALLOWED_URI$1
    } = EXPRESSIONS;
    let ALLOWED_TAGS = null;
    const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
    let ALLOWED_ATTR = null;
    const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
    let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
      tagNameCheck: {
        writable: true,
        configurable: false,
        enumerable: true,
        value: null
      },
      attributeNameCheck: {
        writable: true,
        configurable: false,
        enumerable: true,
        value: null
      },
      allowCustomizedBuiltInElements: {
        writable: true,
        configurable: false,
        enumerable: true,
        value: false
      }
    }));
    let FORBID_TAGS = null;
    let FORBID_ATTR = null;
    let ALLOW_ARIA_ATTR = true;
    let ALLOW_DATA_ATTR = true;
    let ALLOW_UNKNOWN_PROTOCOLS = false;
    let ALLOW_SELF_CLOSE_IN_ATTR = true;
    let SAFE_FOR_TEMPLATES = false;
    let WHOLE_DOCUMENT = false;
    let SET_CONFIG = false;
    let FORCE_BODY = false;
    let RETURN_DOM = false;
    let RETURN_DOM_FRAGMENT = false;
    let RETURN_TRUSTED_TYPE = false;
    let SANITIZE_DOM = true;
    let SANITIZE_NAMED_PROPS = false;
    const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
    let KEEP_CONTENT = true;
    let IN_PLACE = false;
    let USE_PROFILES = {};
    let FORBID_CONTENTS = null;
    const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
    let DATA_URI_TAGS = null;
    const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
    let URI_SAFE_ATTRIBUTES = null;
    const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
    const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
    const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
    const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
    let NAMESPACE = HTML_NAMESPACE;
    let IS_EMPTY_INPUT = false;
    let ALLOWED_NAMESPACES = null;
    const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
    let PARSER_MEDIA_TYPE = null;
    const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
    const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
    let transformCaseFunc = null;
    let CONFIG = null;
    const formElement = document2.createElement("form");
    const isRegexOrFunction = function isRegexOrFunction2(testValue) {
      return testValue instanceof RegExp || testValue instanceof Function;
    };
    const _parseConfig = function _parseConfig2() {
      let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
      if (CONFIG && CONFIG === cfg) {
        return;
      }
      if (!cfg || typeof cfg !== "object") {
        cfg = {};
      }
      cfg = clone(cfg);
      PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
      SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
      transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
      ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
      ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
      ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
      URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") ? addToSet(
        clone(DEFAULT_URI_SAFE_ATTRIBUTES),
        // eslint-disable-line indent
        cfg.ADD_URI_SAFE_ATTR,
        // eslint-disable-line indent
        transformCaseFunc
        // eslint-disable-line indent
      ) : DEFAULT_URI_SAFE_ATTRIBUTES;
      DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") ? addToSet(
        clone(DEFAULT_DATA_URI_TAGS),
        // eslint-disable-line indent
        cfg.ADD_DATA_URI_TAGS,
        // eslint-disable-line indent
        transformCaseFunc
        // eslint-disable-line indent
      ) : DEFAULT_DATA_URI_TAGS;
      FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
      FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
      FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
      USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES : false;
      ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
      ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
      ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
      ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
      SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
      WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
      RETURN_DOM = cfg.RETURN_DOM || false;
      RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
      RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
      FORCE_BODY = cfg.FORCE_BODY || false;
      SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
      SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
      KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
      IN_PLACE = cfg.IN_PLACE || false;
      IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
      NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
      CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
      if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
        CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
      }
      if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
        CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
      }
      if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") {
        CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
      }
      if (SAFE_FOR_TEMPLATES) {
        ALLOW_DATA_ATTR = false;
      }
      if (RETURN_DOM_FRAGMENT) {
        RETURN_DOM = true;
      }
      if (USE_PROFILES) {
        ALLOWED_TAGS = addToSet({}, text);
        ALLOWED_ATTR = [];
        if (USE_PROFILES.html === true) {
          addToSet(ALLOWED_TAGS, html$1);
          addToSet(ALLOWED_ATTR, html);
        }
        if (USE_PROFILES.svg === true) {
          addToSet(ALLOWED_TAGS, svg$1);
          addToSet(ALLOWED_ATTR, svg);
          addToSet(ALLOWED_ATTR, xml);
        }
        if (USE_PROFILES.svgFilters === true) {
          addToSet(ALLOWED_TAGS, svgFilters);
          addToSet(ALLOWED_ATTR, svg);
          addToSet(ALLOWED_ATTR, xml);
        }
        if (USE_PROFILES.mathMl === true) {
          addToSet(ALLOWED_TAGS, mathMl$1);
          addToSet(ALLOWED_ATTR, mathMl);
          addToSet(ALLOWED_ATTR, xml);
        }
      }
      if (cfg.ADD_TAGS) {
        if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
          ALLOWED_TAGS = clone(ALLOWED_TAGS);
        }
        addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
      }
      if (cfg.ADD_ATTR) {
        if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
          ALLOWED_ATTR = clone(ALLOWED_ATTR);
        }
        addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
      }
      if (cfg.ADD_URI_SAFE_ATTR) {
        addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
      }
      if (cfg.FORBID_CONTENTS) {
        if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
          FORBID_CONTENTS = clone(FORBID_CONTENTS);
        }
        addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
      }
      if (KEEP_CONTENT) {
        ALLOWED_TAGS["#text"] = true;
      }
      if (WHOLE_DOCUMENT) {
        addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
      }
      if (ALLOWED_TAGS.table) {
        addToSet(ALLOWED_TAGS, ["tbody"]);
        delete FORBID_TAGS.tbody;
      }
      if (cfg.TRUSTED_TYPES_POLICY) {
        if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
          throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
        }
        if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
          throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
        }
        trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
        emptyHTML = trustedTypesPolicy.createHTML("");
      } else {
        if (trustedTypesPolicy === void 0) {
          trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
        }
        if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
          emptyHTML = trustedTypesPolicy.createHTML("");
        }
      }
      if (freeze) {
        freeze(cfg);
      }
      CONFIG = cfg;
    };
    const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
    const HTML_INTEGRATION_POINTS = addToSet({}, ["foreignobject", "desc", "title", "annotation-xml"]);
    const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
    const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
    const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
    const _checkValidNamespace = function _checkValidNamespace2(element) {
      let parent = getParentNode(element);
      if (!parent || !parent.tagName) {
        parent = {
          namespaceURI: NAMESPACE,
          tagName: "template"
        };
      }
      const tagName = stringToLowerCase(element.tagName);
      const parentTagName = stringToLowerCase(parent.tagName);
      if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
        return false;
      }
      if (element.namespaceURI === SVG_NAMESPACE) {
        if (parent.namespaceURI === HTML_NAMESPACE) {
          return tagName === "svg";
        }
        if (parent.namespaceURI === MATHML_NAMESPACE) {
          return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
        }
        return Boolean(ALL_SVG_TAGS[tagName]);
      }
      if (element.namespaceURI === MATHML_NAMESPACE) {
        if (parent.namespaceURI === HTML_NAMESPACE) {
          return tagName === "math";
        }
        if (parent.namespaceURI === SVG_NAMESPACE) {
          return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
        }
        return Boolean(ALL_MATHML_TAGS[tagName]);
      }
      if (element.namespaceURI === HTML_NAMESPACE) {
        if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
          return false;
        }
        if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
          return false;
        }
        return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
      }
      if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
        return true;
      }
      return false;
    };
    const _forceRemove = function _forceRemove2(node) {
      arrayPush(DOMPurify.removed, {
        element: node
      });
      try {
        node.parentNode.removeChild(node);
      } catch (_) {
        node.remove();
      }
    };
    const _removeAttribute = function _removeAttribute2(name, node) {
      try {
        arrayPush(DOMPurify.removed, {
          attribute: node.getAttributeNode(name),
          from: node
        });
      } catch (_) {
        arrayPush(DOMPurify.removed, {
          attribute: null,
          from: node
        });
      }
      node.removeAttribute(name);
      if (name === "is" && !ALLOWED_ATTR[name]) {
        if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
          try {
            _forceRemove(node);
          } catch (_) {
          }
        } else {
          try {
            node.setAttribute(name, "");
          } catch (_) {
          }
        }
      }
    };
    const _initDocument = function _initDocument2(dirty) {
      let doc = null;
      let leadingWhitespace = null;
      if (FORCE_BODY) {
        dirty = "<remove></remove>" + dirty;
      } else {
        const matches = stringMatch(dirty, /^[\r\n\t ]+/);
        leadingWhitespace = matches && matches[0];
      }
      if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
        dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
      }
      const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
      if (NAMESPACE === HTML_NAMESPACE) {
        try {
          doc = new DOMParser2().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
        } catch (_) {
        }
      }
      if (!doc || !doc.documentElement) {
        doc = implementation.createDocument(NAMESPACE, "template", null);
        try {
          doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
        } catch (_) {
        }
      }
      const body = doc.body || doc.documentElement;
      if (dirty && leadingWhitespace) {
        body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
      }
      if (NAMESPACE === HTML_NAMESPACE) {
        return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
      }
      return WHOLE_DOCUMENT ? doc.documentElement : body;
    };
    const _createNodeIterator = function _createNodeIterator2(root) {
      return createNodeIterator.call(
        root.ownerDocument || root,
        root,
        // eslint-disable-next-line no-bitwise
        NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
        null
      );
    };
    const _isClobbered = function _isClobbered2(elm) {
      return elm instanceof HTMLFormElement && (typeof elm.nodeName !== "string" || typeof elm.textContent !== "string" || typeof elm.removeChild !== "function" || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== "function" || typeof elm.setAttribute !== "function" || typeof elm.namespaceURI !== "string" || typeof elm.insertBefore !== "function" || typeof elm.hasChildNodes !== "function");
    };
    const _isNode = function _isNode2(object) {
      return typeof Node === "function" && object instanceof Node;
    };
    const _executeHook = function _executeHook2(entryPoint, currentNode, data) {
      if (!hooks[entryPoint]) {
        return;
      }
      arrayForEach(hooks[entryPoint], (hook) => {
        hook.call(DOMPurify, currentNode, data, CONFIG);
      });
    };
    const _sanitizeElements = function _sanitizeElements2(currentNode) {
      let content = null;
      _executeHook("beforeSanitizeElements", currentNode, null);
      if (_isClobbered(currentNode)) {
        _forceRemove(currentNode);
        return true;
      }
      const tagName = transformCaseFunc(currentNode.nodeName);
      _executeHook("uponSanitizeElement", currentNode, {
        tagName,
        allowedTags: ALLOWED_TAGS
      });
      if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
        _forceRemove(currentNode);
        return true;
      }
      if (currentNode.nodeType === 7) {
        _forceRemove(currentNode);
        return true;
      }
      if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
        if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
          if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
            return false;
          }
          if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
            return false;
          }
        }
        if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
          const parentNode = getParentNode(currentNode) || currentNode.parentNode;
          const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
          if (childNodes && parentNode) {
            const childCount = childNodes.length;
            for (let i = childCount - 1; i >= 0; --i) {
              parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
            }
          }
        }
        _forceRemove(currentNode);
        return true;
      }
      if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
        _forceRemove(currentNode);
        return true;
      }
      if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
        _forceRemove(currentNode);
        return true;
      }
      if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
        content = currentNode.textContent;
        arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
          content = stringReplace(content, expr, " ");
        });
        if (currentNode.textContent !== content) {
          arrayPush(DOMPurify.removed, {
            element: currentNode.cloneNode()
          });
          currentNode.textContent = content;
        }
      }
      _executeHook("afterSanitizeElements", currentNode, null);
      return false;
    };
    const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
      if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
        return false;
      }
      if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName))
        ;
      else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName))
        ;
      else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
        if (
          // First condition does a very basic check if a) it's basically a valid custom element tagname AND
          // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
          // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
          _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND
          // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
          lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))
        )
          ;
        else {
          return false;
        }
      } else if (URI_SAFE_ATTRIBUTES[lcName])
        ;
      else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, "")))
        ;
      else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag])
        ;
      else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value, ATTR_WHITESPACE2, "")))
        ;
      else if (value) {
        return false;
      } else
        ;
      return true;
    };
    const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
      return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT2);
    };
    const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
      _executeHook("beforeSanitizeAttributes", currentNode, null);
      const {
        attributes
      } = currentNode;
      if (!attributes) {
        return;
      }
      const hookEvent = {
        attrName: "",
        attrValue: "",
        keepAttr: true,
        allowedAttributes: ALLOWED_ATTR
      };
      let l = attributes.length;
      while (l--) {
        const attr = attributes[l];
        const {
          name,
          namespaceURI,
          value: attrValue
        } = attr;
        const lcName = transformCaseFunc(name);
        let value = name === "value" ? attrValue : stringTrim(attrValue);
        hookEvent.attrName = lcName;
        hookEvent.attrValue = value;
        hookEvent.keepAttr = true;
        hookEvent.forceKeepAttr = void 0;
        _executeHook("uponSanitizeAttribute", currentNode, hookEvent);
        value = hookEvent.attrValue;
        if (hookEvent.forceKeepAttr) {
          continue;
        }
        _removeAttribute(name, currentNode);
        if (!hookEvent.keepAttr) {
          continue;
        }
        if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
          _removeAttribute(name, currentNode);
          continue;
        }
        if (SAFE_FOR_TEMPLATES) {
          arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
            value = stringReplace(value, expr, " ");
          });
        }
        const lcTag = transformCaseFunc(currentNode.nodeName);
        if (!_isValidAttribute(lcTag, lcName, value)) {
          continue;
        }
        if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) {
          _removeAttribute(name, currentNode);
          value = SANITIZE_NAMED_PROPS_PREFIX + value;
        }
        if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
          if (namespaceURI)
            ;
          else {
            switch (trustedTypes.getAttributeType(lcTag, lcName)) {
              case "TrustedHTML": {
                value = trustedTypesPolicy.createHTML(value);
                break;
              }
              case "TrustedScriptURL": {
                value = trustedTypesPolicy.createScriptURL(value);
                break;
              }
            }
          }
        }
        try {
          if (namespaceURI) {
            currentNode.setAttributeNS(namespaceURI, name, value);
          } else {
            currentNode.setAttribute(name, value);
          }
          arrayPop(DOMPurify.removed);
        } catch (_) {
        }
      }
      _executeHook("afterSanitizeAttributes", currentNode, null);
    };
    const _sanitizeShadowDOM = function _sanitizeShadowDOM2(fragment) {
      let shadowNode = null;
      const shadowIterator = _createNodeIterator(fragment);
      _executeHook("beforeSanitizeShadowDOM", fragment, null);
      while (shadowNode = shadowIterator.nextNode()) {
        _executeHook("uponSanitizeShadowNode", shadowNode, null);
        if (_sanitizeElements(shadowNode)) {
          continue;
        }
        if (shadowNode.content instanceof DocumentFragment) {
          _sanitizeShadowDOM2(shadowNode.content);
        }
        _sanitizeAttributes(shadowNode);
      }
      _executeHook("afterSanitizeShadowDOM", fragment, null);
    };
    DOMPurify.sanitize = function(dirty) {
      let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      let body = null;
      let importedNode = null;
      let currentNode = null;
      let returnNode = null;
      IS_EMPTY_INPUT = !dirty;
      if (IS_EMPTY_INPUT) {
        dirty = "<!-->";
      }
      if (typeof dirty !== "string" && !_isNode(dirty)) {
        if (typeof dirty.toString === "function") {
          dirty = dirty.toString();
          if (typeof dirty !== "string") {
            throw typeErrorCreate("dirty is not a string, aborting");
          }
        } else {
          throw typeErrorCreate("toString is not a function");
        }
      }
      if (!DOMPurify.isSupported) {
        return dirty;
      }
      if (!SET_CONFIG) {
        _parseConfig(cfg);
      }
      DOMPurify.removed = [];
      if (typeof dirty === "string") {
        IN_PLACE = false;
      }
      if (IN_PLACE) {
        if (dirty.nodeName) {
          const tagName = transformCaseFunc(dirty.nodeName);
          if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
            throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
          }
        }
      } else if (dirty instanceof Node) {
        body = _initDocument("<!---->");
        importedNode = body.ownerDocument.importNode(dirty, true);
        if (importedNode.nodeType === 1 && importedNode.nodeName === "BODY") {
          body = importedNode;
        } else if (importedNode.nodeName === "HTML") {
          body = importedNode;
        } else {
          body.appendChild(importedNode);
        }
      } else {
        if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
        dirty.indexOf("<") === -1) {
          return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
        }
        body = _initDocument(dirty);
        if (!body) {
          return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
        }
      }
      if (body && FORCE_BODY) {
        _forceRemove(body.firstChild);
      }
      const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
      while (currentNode = nodeIterator.nextNode()) {
        if (_sanitizeElements(currentNode)) {
          continue;
        }
        if (currentNode.content instanceof DocumentFragment) {
          _sanitizeShadowDOM(currentNode.content);
        }
        _sanitizeAttributes(currentNode);
      }
      if (IN_PLACE) {
        return dirty;
      }
      if (RETURN_DOM) {
        if (RETURN_DOM_FRAGMENT) {
          returnNode = createDocumentFragment.call(body.ownerDocument);
          while (body.firstChild) {
            returnNode.appendChild(body.firstChild);
          }
        } else {
          returnNode = body;
        }
        if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
          returnNode = importNode.call(originalDocument, returnNode, true);
        }
        return returnNode;
      }
      let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
      if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
        serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
      }
      if (SAFE_FOR_TEMPLATES) {
        arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
          serializedHTML = stringReplace(serializedHTML, expr, " ");
        });
      }
      return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
    };
    DOMPurify.setConfig = function() {
      let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
      _parseConfig(cfg);
      SET_CONFIG = true;
    };
    DOMPurify.clearConfig = function() {
      CONFIG = null;
      SET_CONFIG = false;
    };
    DOMPurify.isValidAttribute = function(tag, attr, value) {
      if (!CONFIG) {
        _parseConfig({});
      }
      const lcTag = transformCaseFunc(tag);
      const lcName = transformCaseFunc(attr);
      return _isValidAttribute(lcTag, lcName, value);
    };
    DOMPurify.addHook = function(entryPoint, hookFunction) {
      if (typeof hookFunction !== "function") {
        return;
      }
      hooks[entryPoint] = hooks[entryPoint] || [];
      arrayPush(hooks[entryPoint], hookFunction);
    };
    DOMPurify.removeHook = function(entryPoint) {
      if (hooks[entryPoint]) {
        return arrayPop(hooks[entryPoint]);
      }
    };
    DOMPurify.removeHooks = function(entryPoint) {
      if (hooks[entryPoint]) {
        hooks[entryPoint] = [];
      }
    };
    DOMPurify.removeAllHooks = function() {
      hooks = {};
    };
    return DOMPurify;
  }
  var purify = createDOMPurify();
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  function getDefaultExportFromCjs(x) {
    return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
  }
  var md5$1 = { exports: {} };
  (function(module) {
    (function($2) {
      function safeAdd(x, y) {
        var lsw = (x & 65535) + (y & 65535);
        var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
        return msw << 16 | lsw & 65535;
      }
      function bitRotateLeft(num, cnt) {
        return num << cnt | num >>> 32 - cnt;
      }
      function md5cmn(q, a, b, x, s, t) {
        return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
      }
      function md5ff(a, b, c, d, x, s, t) {
        return md5cmn(b & c | ~b & d, a, b, x, s, t);
      }
      function md5gg(a, b, c, d, x, s, t) {
        return md5cmn(b & d | c & ~d, a, b, x, s, t);
      }
      function md5hh(a, b, c, d, x, s, t) {
        return md5cmn(b ^ c ^ d, a, b, x, s, t);
      }
      function md5ii(a, b, c, d, x, s, t) {
        return md5cmn(c ^ (b | ~d), a, b, x, s, t);
      }
      function binlMD5(x, len) {
        x[len >> 5] |= 128 << len % 32;
        x[(len + 64 >>> 9 << 4) + 14] = len;
        var i;
        var olda;
        var oldb;
        var oldc;
        var oldd;
        var a = 1732584193;
        var b = -271733879;
        var c = -1732584194;
        var d = 271733878;
        for (i = 0; i < x.length; i += 16) {
          olda = a;
          oldb = b;
          oldc = c;
          oldd = d;
          a = md5ff(a, b, c, d, x[i], 7, -680876936);
          d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
          c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
          b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
          a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
          d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
          c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
          b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
          a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
          d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
          c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
          b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
          a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
          d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
          c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
          b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
          a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
          d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
          c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
          b = md5gg(b, c, d, a, x[i], 20, -373897302);
          a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
          d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
          c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
          b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
          a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
          d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
          c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
          b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
          a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
          d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
          c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
          b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
          a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
          d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
          c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
          b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
          a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
          d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
          c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
          b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
          a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
          d = md5hh(d, a, b, c, x[i], 11, -358537222);
          c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
          b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
          a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
          d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
          c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
          b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
          a = md5ii(a, b, c, d, x[i], 6, -198630844);
          d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
          c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
          b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
          a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
          d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
          c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
          b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
          a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
          d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
          c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
          b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
          a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
          d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
          c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
          b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
          a = safeAdd(a, olda);
          b = safeAdd(b, oldb);
          c = safeAdd(c, oldc);
          d = safeAdd(d, oldd);
        }
        return [a, b, c, d];
      }
      function binl2rstr(input) {
        var i;
        var output = "";
        var length32 = input.length * 32;
        for (i = 0; i < length32; i += 8) {
          output += String.fromCharCode(input[i >> 5] >>> i % 32 & 255);
        }
        return output;
      }
      function rstr2binl(input) {
        var i;
        var output = [];
        output[(input.length >> 2) - 1] = void 0;
        for (i = 0; i < output.length; i += 1) {
          output[i] = 0;
        }
        var length8 = input.length * 8;
        for (i = 0; i < length8; i += 8) {
          output[i >> 5] |= (input.charCodeAt(i / 8) & 255) << i % 32;
        }
        return output;
      }
      function rstrMD5(s) {
        return binl2rstr(binlMD5(rstr2binl(s), s.length * 8));
      }
      function rstrHMACMD5(key, data) {
        var i;
        var bkey = rstr2binl(key);
        var ipad = [];
        var opad = [];
        var hash;
        ipad[15] = opad[15] = void 0;
        if (bkey.length > 16) {
          bkey = binlMD5(bkey, key.length * 8);
        }
        for (i = 0; i < 16; i += 1) {
          ipad[i] = bkey[i] ^ 909522486;
          opad[i] = bkey[i] ^ 1549556828;
        }
        hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
        return binl2rstr(binlMD5(opad.concat(hash), 512 + 128));
      }
      function rstr2hex(input) {
        var hexTab = "0123456789abcdef";
        var output = "";
        var x;
        var i;
        for (i = 0; i < input.length; i += 1) {
          x = input.charCodeAt(i);
          output += hexTab.charAt(x >>> 4 & 15) + hexTab.charAt(x & 15);
        }
        return output;
      }
      function str2rstrUTF8(input) {
        return unescape(encodeURIComponent(input));
      }
      function rawMD5(s) {
        return rstrMD5(str2rstrUTF8(s));
      }
      function hexMD5(s) {
        return rstr2hex(rawMD5(s));
      }
      function rawHMACMD5(k, d) {
        return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d));
      }
      function hexHMACMD5(k, d) {
        return rstr2hex(rawHMACMD5(k, d));
      }
      function md52(string, key, raw) {
        if (!key) {
          if (!raw) {
            return hexMD5(string);
          }
          return rawMD5(string);
        }
        if (!raw) {
          return hexHMACMD5(key, string);
        }
        return rawHMACMD5(key, string);
      }
      if (module.exports) {
        module.exports = md52;
      } else {
        $2.md5 = md52;
      }
    })(commonjsGlobal);
  })(md5$1);
  var md5Exports = md5$1.exports;
  const md5 = /* @__PURE__ */ getDefaultExportFromCjs(md5Exports);
  var Typr = {};
  Typr.parse = function(buff) {
    var bin = Typr._bin;
    var data = new Uint8Array(buff);
    var offset = 0;
    bin.readFixed(data, offset);
    offset += 4;
    var numTables = bin.readUshort(data, offset);
    offset += 2;
    bin.readUshort(data, offset);
    offset += 2;
    bin.readUshort(data, offset);
    offset += 2;
    bin.readUshort(data, offset);
    offset += 2;
    var tags = ["cmap", "head", "hhea", "maxp", "hmtx", "name", "OS/2", "post", "loca", "glyf", "kern", "CFF ", "GPOS", "GSUB", "SVG "];
    var obj = { _data: data };
    var tabs = {};
    for (var i = 0; i < numTables; i++) {
      var tag = bin.readASCII(data, offset, 4);
      offset += 4;
      bin.readUint(data, offset);
      offset += 4;
      var toffset = bin.readUint(data, offset);
      offset += 4;
      var length = bin.readUint(data, offset);
      offset += 4;
      tabs[tag] = { offset: toffset, length };
    }
    for (var i = 0; i < tags.length; i++) {
      var t = tags[i];
      if (tabs[t])
        obj[t.trim()] = Typr[t.trim()].parse(data, tabs[t].offset, tabs[t].length, obj);
    }
    return obj;
  };
  Typr._tabOffset = function(data, tab) {
    var bin = Typr._bin;
    var numTables = bin.readUshort(data, 4);
    var offset = 12;
    for (var i = 0; i < numTables; i++) {
      var tag = bin.readASCII(data, offset, 4);
      offset += 4;
      bin.readUint(data, offset);
      offset += 4;
      var toffset = bin.readUint(data, offset);
      offset += 4;
      bin.readUint(data, offset);
      offset += 4;
      if (tag == tab)
        return toffset;
    }
    return 0;
  };
  Typr._bin = { readFixed: function(data, o) {
    return (data[o] << 8 | data[o + 1]) + (data[o + 2] << 8 | data[o + 3]) / (256 * 256 + 4);
  }, readF2dot14: function(data, o) {
    var num = Typr._bin.readShort(data, o);
    return num / 16384;
  }, readInt: function(buff, p) {
    var a = Typr._bin.t.uint8;
    a[0] = buff[p + 3];
    a[1] = buff[p + 2];
    a[2] = buff[p + 1];
    a[3] = buff[p];
    return Typr._bin.t.int32[0];
  }, readInt8: function(buff, p) {
    var a = Typr._bin.t.uint8;
    a[0] = buff[p];
    return Typr._bin.t.int8[0];
  }, readShort: function(buff, p) {
    var a = Typr._bin.t.uint8;
    a[1] = buff[p];
    a[0] = buff[p + 1];
    return Typr._bin.t.int16[0];
  }, readUshort: function(buff, p) {
    return buff[p] << 8 | buff[p + 1];
  }, readUshorts: function(buff, p, len) {
    var arr = [];
    for (var i = 0; i < len; i++)
      arr.push(Typr._bin.readUshort(buff, p + i * 2));
    return arr;
  }, readUint: function(buff, p) {
    var a = Typr._bin.t.uint8;
    a[3] = buff[p];
    a[2] = buff[p + 1];
    a[1] = buff[p + 2];
    a[0] = buff[p + 3];
    return Typr._bin.t.uint32[0];
  }, readUint64: function(buff, p) {
    return Typr._bin.readUint(buff, p) * (4294967295 + 1) + Typr._bin.readUint(buff, p + 4);
  }, readASCII: function(buff, p, l) {
    var s = "";
    for (var i = 0; i < l; i++)
      s += String.fromCharCode(buff[p + i]);
    return s;
  }, readUnicode: function(buff, p, l) {
    var s = "";
    for (var i = 0; i < l; i++) {
      var c = buff[p++] << 8 | buff[p++];
      s += String.fromCharCode(c);
    }
    return s;
  }, _tdec: window["TextDecoder"] ? new window["TextDecoder"]() : null, readUTF8: function(buff, p, l) {
    var tdec = Typr._bin._tdec;
    if (tdec && p == 0 && l == buff.length)
      return tdec["decode"](buff);
    return Typr._bin.readASCII(buff, p, l);
  }, readBytes: function(buff, p, l) {
    var arr = [];
    for (var i = 0; i < l; i++)
      arr.push(buff[p + i]);
    return arr;
  }, readASCIIArray: function(buff, p, l) {
    var s = [];
    for (var i = 0; i < l; i++)
      s.push(String.fromCharCode(buff[p + i]));
    return s;
  } };
  Typr._bin.t = { buff: new ArrayBuffer(8) };
  Typr._bin.t.int8 = new Int8Array(Typr._bin.t.buff);
  Typr._bin.t.uint8 = new Uint8Array(Typr._bin.t.buff);
  Typr._bin.t.int16 = new Int16Array(Typr._bin.t.buff);
  Typr._bin.t.uint16 = new Uint16Array(Typr._bin.t.buff);
  Typr._bin.t.int32 = new Int32Array(Typr._bin.t.buff);
  Typr._bin.t.uint32 = new Uint32Array(Typr._bin.t.buff);
  Typr._lctf = {};
  Typr._lctf.parse = function(data, offset, length, font, subt) {
    var bin = Typr._bin;
    var obj = {};
    var offset0 = offset;
    bin.readFixed(data, offset);
    offset += 4;
    var offScriptList = bin.readUshort(data, offset);
    offset += 2;
    var offFeatureList = bin.readUshort(data, offset);
    offset += 2;
    var offLookupList = bin.readUshort(data, offset);
    offset += 2;
    obj.scriptList = Typr._lctf.readScriptList(data, offset0 + offScriptList);
    obj.featureList = Typr._lctf.readFeatureList(data, offset0 + offFeatureList);
    obj.lookupList = Typr._lctf.readLookupList(data, offset0 + offLookupList, subt);
    return obj;
  };
  Typr._lctf.readLookupList = function(data, offset, subt) {
    var bin = Typr._bin;
    var offset0 = offset;
    var obj = [];
    var count = bin.readUshort(data, offset);
    offset += 2;
    for (var i = 0; i < count; i++) {
      var noff = bin.readUshort(data, offset);
      offset += 2;
      var lut = Typr._lctf.readLookupTable(data, offset0 + noff, subt);
      obj.push(lut);
    }
    return obj;
  };
  Typr._lctf.readLookupTable = function(data, offset, subt) {
    var bin = Typr._bin;
    var offset0 = offset;
    var obj = { tabs: [] };
    obj.ltype = bin.readUshort(data, offset);
    offset += 2;
    obj.flag = bin.readUshort(data, offset);
    offset += 2;
    var cnt = bin.readUshort(data, offset);
    offset += 2;
    for (var i = 0; i < cnt; i++) {
      var noff = bin.readUshort(data, offset);
      offset += 2;
      var tab = subt(data, obj.ltype, offset0 + noff);
      obj.tabs.push(tab);
    }
    return obj;
  };
  Typr._lctf.numOfOnes = function(n) {
    var num = 0;
    for (var i = 0; i < 32; i++)
      if ((n >>> i & 1) != 0)
        num++;
    return num;
  };
  Typr._lctf.readClassDef = function(data, offset) {
    var bin = Typr._bin;
    var obj = [];
    var format = bin.readUshort(data, offset);
    offset += 2;
    if (format == 1) {
      var startGlyph = bin.readUshort(data, offset);
      offset += 2;
      var glyphCount = bin.readUshort(data, offset);
      offset += 2;
      for (var i = 0; i < glyphCount; i++) {
        obj.push(startGlyph + i);
        obj.push(startGlyph + i);
        obj.push(bin.readUshort(data, offset));
        offset += 2;
      }
    }
    if (format == 2) {
      var count = bin.readUshort(data, offset);
      offset += 2;
      for (var i = 0; i < count; i++) {
        obj.push(bin.readUshort(data, offset));
        offset += 2;
        obj.push(bin.readUshort(data, offset));
        offset += 2;
        obj.push(bin.readUshort(data, offset));
        offset += 2;
      }
    }
    return obj;
  };
  Typr._lctf.getInterval = function(tab, val) {
    for (var i = 0; i < tab.length; i += 3) {
      var start = tab[i], end = tab[i + 1];
      tab[i + 2];
      if (start <= val && val <= end)
        return i;
    }
    return -1;
  };
  Typr._lctf.readValueRecord = function(data, offset, valFmt) {
    var bin = Typr._bin;
    var arr = [];
    arr.push(valFmt & 1 ? bin.readShort(data, offset) : 0);
    offset += valFmt & 1 ? 2 : 0;
    arr.push(valFmt & 2 ? bin.readShort(data, offset) : 0);
    offset += valFmt & 2 ? 2 : 0;
    arr.push(valFmt & 4 ? bin.readShort(data, offset) : 0);
    offset += valFmt & 4 ? 2 : 0;
    arr.push(valFmt & 8 ? bin.readShort(data, offset) : 0);
    offset += valFmt & 8 ? 2 : 0;
    return arr;
  };
  Typr._lctf.readCoverage = function(data, offset) {
    var bin = Typr._bin;
    var cvg = {};
    cvg.fmt = bin.readUshort(data, offset);
    offset += 2;
    var count = bin.readUshort(data, offset);
    offset += 2;
    if (cvg.fmt == 1)
      cvg.tab = bin.readUshorts(data, offset, count);
    if (cvg.fmt == 2)
      cvg.tab = bin.readUshorts(data, offset, count * 3);
    return cvg;
  };
  Typr._lctf.coverageIndex = function(cvg, val) {
    var tab = cvg.tab;
    if (cvg.fmt == 1)
      return tab.indexOf(val);
    if (cvg.fmt == 2) {
      var ind = Typr._lctf.getInterval(tab, val);
      if (ind != -1)
        return tab[ind + 2] + (val - tab[ind]);
    }
    return -1;
  };
  Typr._lctf.readFeatureList = function(data, offset) {
    var bin = Typr._bin;
    var offset0 = offset;
    var obj = [];
    var count = bin.readUshort(data, offset);
    offset += 2;
    for (var i = 0; i < count; i++) {
      var tag = bin.readASCII(data, offset, 4);
      offset += 4;
      var noff = bin.readUshort(data, offset);
      offset += 2;
      obj.push({ tag: tag.trim(), tab: Typr._lctf.readFeatureTable(data, offset0 + noff) });
    }
    return obj;
  };
  Typr._lctf.readFeatureTable = function(data, offset) {
    var bin = Typr._bin;
    bin.readUshort(data, offset);
    offset += 2;
    var lookupCount = bin.readUshort(data, offset);
    offset += 2;
    var indices = [];
    for (var i = 0; i < lookupCount; i++)
      indices.push(bin.readUshort(data, offset + 2 * i));
    return indices;
  };
  Typr._lctf.readScriptList = function(data, offset) {
    var bin = Typr._bin;
    var offset0 = offset;
    var obj = {};
    var count = bin.readUshort(data, offset);
    offset += 2;
    for (var i = 0; i < count; i++) {
      var tag = bin.readASCII(data, offset, 4);
      offset += 4;
      var noff = bin.readUshort(data, offset);
      offset += 2;
      obj[tag.trim()] = Typr._lctf.readScriptTable(data, offset0 + noff);
    }
    return obj;
  };
  Typr._lctf.readScriptTable = function(data, offset) {
    var bin = Typr._bin;
    var offset0 = offset;
    var obj = {};
    var defLangSysOff = bin.readUshort(data, offset);
    offset += 2;
    obj.default = Typr._lctf.readLangSysTable(data, offset0 + defLangSysOff);
    var langSysCount = bin.readUshort(data, offset);
    offset += 2;
    for (var i = 0; i < langSysCount; i++) {
      var tag = bin.readASCII(data, offset, 4);
      offset += 4;
      var langSysOff = bin.readUshort(data, offset);
      offset += 2;
      obj[tag.trim()] = Typr._lctf.readLangSysTable(data, offset0 + langSysOff);
    }
    return obj;
  };
  Typr._lctf.readLangSysTable = function(data, offset) {
    var bin = Typr._bin;
    var obj = {};
    bin.readUshort(data, offset);
    offset += 2;
    obj.reqFeature = bin.readUshort(data, offset);
    offset += 2;
    var featureCount = bin.readUshort(data, offset);
    offset += 2;
    obj.features = bin.readUshorts(data, offset, featureCount);
    return obj;
  };
  Typr.CFF = {};
  Typr.CFF.parse = function(data, offset, length) {
    var bin = Typr._bin;
    data = new Uint8Array(data.buffer, offset, length);
    offset = 0;
    data[offset];
    offset++;
    data[offset];
    offset++;
    data[offset];
    offset++;
    data[offset];
    offset++;
    var ninds = [];
    offset = Typr.CFF.readIndex(data, offset, ninds);
    var names = [];
    for (var i = 0; i < ninds.length - 1; i++)
      names.push(bin.readASCII(data, offset + ninds[i], ninds[i + 1] - ninds[i]));
    offset += ninds[ninds.length - 1];
    var tdinds = [];
    offset = Typr.CFF.readIndex(data, offset, tdinds);
    var topDicts = [];
    for (var i = 0; i < tdinds.length - 1; i++)
      topDicts.push(Typr.CFF.readDict(data, offset + tdinds[i], offset + tdinds[i + 1]));
    offset += tdinds[tdinds.length - 1];
    var topdict = topDicts[0];
    var sinds = [];
    offset = Typr.CFF.readIndex(data, offset, sinds);
    var strings = [];
    for (var i = 0; i < sinds.length - 1; i++)
      strings.push(bin.readASCII(data, offset + sinds[i], sinds[i + 1] - sinds[i]));
    offset += sinds[sinds.length - 1];
    Typr.CFF.readSubrs(data, offset, topdict);
    if (topdict.CharStrings) {
      offset = topdict.CharStrings;
      var sinds = [];
      offset = Typr.CFF.readIndex(data, offset, sinds);
      var cstr = [];
      for (var i = 0; i < sinds.length - 1; i++)
        cstr.push(bin.readBytes(data, offset + sinds[i], sinds[i + 1] - sinds[i]));
      topdict.CharStrings = cstr;
    }
    if (topdict.Encoding)
      topdict.Encoding = Typr.CFF.readEncoding(data, topdict.Encoding, topdict.CharStrings.length);
    if (topdict.charset)
      topdict.charset = Typr.CFF.readCharset(data, topdict.charset, topdict.CharStrings.length);
    if (topdict.Private) {
      offset = topdict.Private[1];
      topdict.Private = Typr.CFF.readDict(data, offset, offset + topdict.Private[0]);
      if (topdict.Private.Subrs)
        Typr.CFF.readSubrs(data, offset + topdict.Private.Subrs, topdict.Private);
    }
    var obj = {};
    for (var p in topdict) {
      if (["FamilyName", "FullName", "Notice", "version", "Copyright"].indexOf(p) != -1)
        obj[p] = strings[topdict[p] - 426 + 35];
      else
        obj[p] = topdict[p];
    }
    return obj;
  };
  Typr.CFF.readSubrs = function(data, offset, obj) {
    var bin = Typr._bin;
    var gsubinds = [];
    offset = Typr.CFF.readIndex(data, offset, gsubinds);
    var bias, nSubrs = gsubinds.length;
    if (nSubrs < 1240)
      bias = 107;
    else if (nSubrs < 33900)
      bias = 1131;
    else
      bias = 32768;
    obj.Bias = bias;
    obj.Subrs = [];
    for (var i = 0; i < gsubinds.length - 1; i++)
      obj.Subrs.push(bin.readBytes(data, offset + gsubinds[i], gsubinds[i + 1] - gsubinds[i]));
  };
  Typr.CFF.tableSE = [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, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 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, 0, 0, 0, 0, 0, 0, 0, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 0, 111, 112, 113, 114, 0, 115, 116, 117, 118, 119, 120, 121, 122, 0, 123, 0, 124, 125, 126, 127, 128, 129, 130, 131, 0, 132, 133, 0, 134, 135, 136, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 0, 139, 0, 0, 0, 0, 140, 141, 142, 143, 0, 0, 0, 0, 0, 144, 0, 0, 0, 145, 0, 0, 146, 147, 148, 149, 0, 0, 0, 0];
  Typr.CFF.glyphByUnicode = function(cff, code) {
    for (var i = 0; i < cff.charset.length; i++)
      if (cff.charset[i] == code)
        return i;
    return -1;
  };
  Typr.CFF.glyphBySE = function(cff, charcode) {
    if (charcode < 0 || charcode > 255)
      return -1;
    return Typr.CFF.glyphByUnicode(cff, Typr.CFF.tableSE[charcode]);
  };
  Typr.CFF.readEncoding = function(data, offset, num) {
    Typr._bin;
    var array = [".notdef"];
    var format = data[offset];
    offset++;
    if (format == 0) {
      var nCodes = data[offset];
      offset++;
      for (var i = 0; i < nCodes; i++)
        array.push(data[offset + i]);
    } else
      throw "error: unknown encoding format: " + format;
    return array;
  };
  Typr.CFF.readCharset = function(data, offset, num) {
    var bin = Typr._bin;
    var charset = [".notdef"];
    var format = data[offset];
    offset++;
    if (format == 0) {
      for (var i = 0; i < num; i++) {
        var first = bin.readUshort(data, offset);
        offset += 2;
        charset.push(first);
      }
    } else if (format == 1 || format == 2) {
      while (charset.length < num) {
        var first = bin.readUshort(data, offset);
        offset += 2;
        var nLeft = 0;
        if (format == 1) {
          nLeft = data[offset];
          offset++;
        } else {
          nLeft = bin.readUshort(data, offset);
          offset += 2;
        }
        for (var i = 0; i <= nLeft; i++) {
          charset.push(first);
          first++;
        }
      }
    } else
      throw "error: format: " + format;
    return charset;
  };
  Typr.CFF.readIndex = function(data, offset, inds) {
    var bin = Typr._bin;
    var count = bin.readUshort(data, offset);
    offset += 2;
    var offsize = data[offset];
    offset++;
    if (offsize == 1)
      for (var i = 0; i < count + 1; i++)
        inds.push(data[offset + i]);
    else if (offsize == 2)
      for (var i = 0; i < count + 1; i++)
        inds.push(bin.readUshort(data, offset + i * 2));
    else if (offsize == 3)
      for (var i = 0; i < count + 1; i++)
        inds.push(bin.readUint(data, offset + i * 3 - 1) & 16777215);
    else if (count != 0)
      throw "unsupported offset size: " + offsize + ", count: " + count;
    offset += (count + 1) * offsize;
    return offset - 1;
  };
  Typr.CFF.getCharString = function(data, offset, o) {
    var bin = Typr._bin;
    var b0 = data[offset], b1 = data[offset + 1];
    data[offset + 2];
    data[offset + 3];
    data[offset + 4];
    var vs = 1;
    var op = null, val = null;
    if (b0 <= 20) {
      op = b0;
      vs = 1;
    }
    if (b0 == 12) {
      op = b0 * 100 + b1;
      vs = 2;
    }
    if (21 <= b0 && b0 <= 27) {
      op = b0;
      vs = 1;
    }
    if (b0 == 28) {
      val = bin.readShort(data, offset + 1);
      vs = 3;
    }
    if (29 <= b0 && b0 <= 31) {
      op = b0;
      vs = 1;
    }
    if (32 <= b0 && b0 <= 246) {
      val = b0 - 139;
      vs = 1;
    }
    if (247 <= b0 && b0 <= 250) {
      val = (b0 - 247) * 256 + b1 + 108;
      vs = 2;
    }
    if (251 <= b0 && b0 <= 254) {
      val = -(b0 - 251) * 256 - b1 - 108;
      vs = 2;
    }
    if (b0 == 255) {
      val = bin.readInt(data, offset + 1) / 65535;
      vs = 5;
    }
    o.val = val != null ? val : "o" + op;
    o.size = vs;
  };
  Typr.CFF.readCharString = function(data, offset, length) {
    var end = offset + length;
    var bin = Typr._bin;
    var arr = [];
    while (offset < end) {
      var b0 = data[offset], b1 = data[offset + 1];
      data[offset + 2];
      data[offset + 3];
      data[offset + 4];
      var vs = 1;
      var op = null, val = null;
      if (b0 <= 20) {
        op = b0;
        vs = 1;
      }
      if (b0 == 12) {
        op = b0 * 100 + b1;
        vs = 2;
      }
      if (b0 == 19 || b0 == 20) {
        op = b0;
        vs = 2;
      }
      if (21 <= b0 && b0 <= 27) {
        op = b0;
        vs = 1;
      }
      if (b0 == 28) {
        val = bin.readShort(data, offset + 1);
        vs = 3;
      }
      if (29 <= b0 && b0 <= 31) {
        op = b0;
        vs = 1;
      }
      if (32 <= b0 && b0 <= 246) {
        val = b0 - 139;
        vs = 1;
      }
      if (247 <= b0 && b0 <= 250) {
        val = (b0 - 247) * 256 + b1 + 108;
        vs = 2;
      }
      if (251 <= b0 && b0 <= 254) {
        val = -(b0 - 251) * 256 - b1 - 108;
        vs = 2;
      }
      if (b0 == 255) {
        val = bin.readInt(data, offset + 1) / 65535;
        vs = 5;
      }
      arr.push(val != null ? val : "o" + op);
      offset += vs;
    }
    return arr;
  };
  Typr.CFF.readDict = function(data, offset, end) {
    var bin = Typr._bin;
    var dict = {};
    var carr = [];
    while (offset < end) {
      var b0 = data[offset], b1 = data[offset + 1];
      data[offset + 2];
      data[offset + 3];
      data[offset + 4];
      var vs = 1;
      var key = null, val = null;
      if (b0 == 28) {
        val = bin.readShort(data, offset + 1);
        vs = 3;
      }
      if (b0 == 29) {
        val = bin.readInt(data, offset + 1);
        vs = 5;
      }
      if (32 <= b0 && b0 <= 246) {
        val = b0 - 139;
        vs = 1;
      }
      if (247 <= b0 && b0 <= 250) {
        val = (b0 - 247) * 256 + b1 + 108;
        vs = 2;
      }
      if (251 <= b0 && b0 <= 254) {
        val = -(b0 - 251) * 256 - b1 - 108;
        vs = 2;
      }
      if (b0 == 255) {
        val = bin.readInt(data, offset + 1) / 65535;
        vs = 5;
        throw "unknown number";
      }
      if (b0 == 30) {
        var nibs = [];
        vs = 1;
        while (true) {
          var b = data[offset + vs];
          vs++;
          var nib0 = b >> 4, nib1 = b & 15;
          if (nib0 != 15)
            nibs.push(nib0);
          if (nib1 != 15)
            nibs.push(nib1);
          if (nib1 == 15)
            break;
        }
        var s = "";
        var chars = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ".", "e", "e-", "reserved", "-", "endOfNumber"];
        for (var i = 0; i < nibs.length; i++)
          s += chars[nibs[i]];
        val = parseFloat(s);
      }
      if (b0 <= 21) {
        var keys = ["version", "Notice", "FullName", "FamilyName", "Weight", "FontBBox", "BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StdHW", "StdVW", "escape", "UniqueID", "XUID", "charset", "Encoding", "CharStrings", "Private", "Subrs", "defaultWidthX", "nominalWidthX"];
        key = keys[b0];
        vs = 1;
        if (b0 == 12) {
          var keys = ["Copyright", "isFixedPitch", "ItalicAngle", "UnderlinePosition", "UnderlineThickness", "PaintType", "CharstringType", "FontMatrix", "StrokeWidth", "BlueScale", "BlueShift", "BlueFuzz", "StemSnapH", "StemSnapV", "ForceBold", 0, 0, "LanguageGroup", "ExpansionFactor", "initialRandomSeed", "SyntheticBase", "PostScript", "BaseFontName", "BaseFontBlend", 0, 0, 0, 0, 0, 0, "ROS", "CIDFontVersion", "CIDFontRevision", "CIDFontType", "CIDCount", "UIDBase", "FDArray", "FDSelect", "FontName"];
          key = keys[b1];
          vs = 2;
        }
      }
      if (key != null) {
        dict[key] = carr.length == 1 ? carr[0] : carr;
        carr = [];
      } else
        carr.push(val);
      offset += vs;
    }
    return dict;
  };
  Typr.cmap = {};
  Typr.cmap.parse = function(data, offset, length) {
    data = new Uint8Array(data.buffer, offset, length);
    offset = 0;
    var bin = Typr._bin;
    var obj = {};
    bin.readUshort(data, offset);
    offset += 2;
    var numTables = bin.readUshort(data, offset);
    offset += 2;
    var offs = [];
    obj.tables = [];
    for (var i = 0; i < numTables; i++) {
      var platformID = bin.readUshort(data, offset);
      offset += 2;
      var encodingID = bin.readUshort(data, offset);
      offset += 2;
      var noffset = bin.readUint(data, offset);
      offset += 4;
      var id = "p" + platformID + "e" + encodingID;
      var tind = offs.indexOf(noffset);
      if (tind == -1) {
        tind = obj.tables.length;
        var subt;
        offs.push(noffset);
        var format = bin.readUshort(data, noffset);
        if (format == 0)
          subt = Typr.cmap.parse0(data, noffset);
        else if (format == 4)
          subt = Typr.cmap.parse4(data, noffset);
        else if (format == 6)
          subt = Typr.cmap.parse6(data, noffset);
        else if (format == 12)
          subt = Typr.cmap.parse12(data, noffset);
        else
          console.log("unknown format: " + format, platformID, encodingID, noffset);
        obj.tables.push(subt);
      }
      if (obj[id] != null)
        throw "multiple tables for one platform+encoding";
      obj[id] = tind;
    }
    return obj;
  };
  Typr.cmap.parse0 = function(data, offset) {
    var bin = Typr._bin;
    var obj = {};
    obj.format = bin.readUshort(data, offset);
    offset += 2;
    var len = bin.readUshort(data, offset);
    offset += 2;
    bin.readUshort(data, offset);
    offset += 2;
    obj.map = [];
    for (var i = 0; i < len - 6; i++)
      obj.map.push(data[offset + i]);
    return obj;
  };
  Typr.cmap.parse4 = function(data, offset) {
    var bin = Typr._bin;
    var offset0 = offset;
    var obj = {};
    obj.format = bin.readUshort(data, offset);
    offset += 2;
    var length = bin.readUshort(data, offset);
    offset += 2;
    bin.readUshort(data, offset);
    offset += 2;
    var segCountX2 = bin.readUshort(data, offset);
    offset += 2;
    var segCount = segCountX2 / 2;
    obj.searchRange = bin.readUshort(data, offset);
    offset += 2;
    obj.entrySelector = bin.readUshort(data, offset);
    offset += 2;
    obj.rangeShift = bin.readUshort(data, offset);
    offset += 2;
    obj.endCount = bin.readUshorts(data, offset, segCount);
    offset += segCount * 2;
    offset += 2;
    obj.startCount = bin.readUshorts(data, offset, segCount);
    offset += segCount * 2;
    obj.idDelta = [];
    for (var i = 0; i < segCount; i++) {
      obj.idDelta.push(bin.readShort(data, offset));
      offset += 2;
    }
    obj.idRangeOffset = bin.readUshorts(data, offset, segCount);
    offset += segCount * 2;
    obj.glyphIdArray = [];
    while (offset < offset0 + length) {
      obj.glyphIdArray.push(bin.readUshort(data, offset));
      offset += 2;
    }
    return obj;
  };
  Typr.cmap.parse6 = function(data, offset) {
    var bin = Typr._bin;
    var obj = {};
    obj.format = bin.readUshort(data, offset);
    offset += 2;
    bin.readUshort(data, offset);
    offset += 2;
    bin.readUshort(data, offset);
    offset += 2;
    obj.firstCode = bin.readUshort(data, offset);
    offset += 2;
    var entryCount = bin.readUshort(data, offset);
    offset += 2;
    obj.glyphIdArray = [];
    for (var i = 0; i < entryCount; i++) {
      obj.glyphIdArray.push(bin.readUshort(data, offset));
      offset += 2;
    }
    return obj;
  };
  Typr.cmap.parse12 = function(data, offset) {
    var bin = Typr._bin;
    var obj = {};
    obj.format = bin.readUshort(data, offset);
    offset += 2;
    offset += 2;
    bin.readUint(data, offset);
    offset += 4;
    bin.readUint(data, offset);
    offset += 4;
    var nGroups = bin.readUint(data, offset);
    offset += 4;
    obj.groups = [];
    for (var i = 0; i < nGroups; i++) {
      var off = offset + i * 12;
      var startCharCode = bin.readUint(data, off + 0);
      var endCharCode = bin.readUint(data, off + 4);
      var startGlyphID = bin.readUint(data, off + 8);
      obj.groups.push([startCharCode, endCharCode, startGlyphID]);
    }
    return obj;
  };
  Typr.glyf = {};
  Typr.glyf.parse = function(data, offset, length, font) {
    var obj = [];
    for (var g = 0; g < font.maxp.numGlyphs; g++)
      obj.push(null);
    return obj;
  };
  Typr.glyf._parseGlyf = function(font, g) {
    var bin = Typr._bin;
    var data = font._data;
    var offset = Typr._tabOffset(data, "glyf") + font.loca[g];
    if (font.loca[g] == font.loca[g + 1])
      return null;
    var gl = {};
    gl.noc = bin.readShort(data, offset);
    offset += 2;
    gl.xMin = bin.readShort(data, offset);
    offset += 2;
    gl.yMin = bin.readShort(data, offset);
    offset += 2;
    gl.xMax = bin.readShort(data, offset);
    offset += 2;
    gl.yMax = bin.readShort(data, offset);
    offset += 2;
    if (gl.xMin >= gl.xMax || gl.yMin >= gl.yMax)
      return null;
    if (gl.noc > 0) {
      gl.endPts = [];
      for (var i = 0; i < gl.noc; i++) {
        gl.endPts.push(bin.readUshort(data, offset));
        offset += 2;
      }
      var instructionLength = bin.readUshort(data, offset);
      offset += 2;
      if (data.length - offset < instructionLength)
        return null;
      gl.instructions = bin.readBytes(data, offset, instructionLength);
      offset += instructionLength;
      var crdnum = gl.endPts[gl.noc - 1] + 1;
      gl.flags = [];
      for (var i = 0; i < crdnum; i++) {
        var flag = data[offset];
        offset++;
        gl.flags.push(flag);
        if ((flag & 8) != 0) {
          var rep = data[offset];
          offset++;
          for (var j = 0; j < rep; j++) {
            gl.flags.push(flag);
            i++;
          }
        }
      }
      gl.xs = [];
      for (var i = 0; i < crdnum; i++) {
        var i8 = (gl.flags[i] & 2) != 0, same = (gl.flags[i] & 16) != 0;
        if (i8) {
          gl.xs.push(same ? data[offset] : -data[offset]);
          offset++;
        } else {
          if (same)
            gl.xs.push(0);
          else {
            gl.xs.push(bin.readShort(data, offset));
            offset += 2;
          }
        }
      }
      gl.ys = [];
      for (var i = 0; i < crdnum; i++) {
        var i8 = (gl.flags[i] & 4) != 0, same = (gl.flags[i] & 32) != 0;
        if (i8) {
          gl.ys.push(same ? data[offset] : -data[offset]);
          offset++;
        } else {
          if (same)
            gl.ys.push(0);
          else {
            gl.ys.push(bin.readShort(data, offset));
            offset += 2;
          }
        }
      }
      var x = 0, y = 0;
      for (var i = 0; i < crdnum; i++) {
        x += gl.xs[i];
        y += gl.ys[i];
        gl.xs[i] = x;
        gl.ys[i] = y;
      }
    } else {
      var ARG_1_AND_2_ARE_WORDS = 1 << 0;
      var ARGS_ARE_XY_VALUES = 1 << 1;
      var WE_HAVE_A_SCALE = 1 << 3;
      var MORE_COMPONENTS = 1 << 5;
      var WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
      var WE_HAVE_A_TWO_BY_TWO = 1 << 7;
      var WE_HAVE_INSTRUCTIONS = 1 << 8;
      gl.parts = [];
      var flags;
      do {
        flags = bin.readUshort(data, offset);
        offset += 2;
        var part = { m: { a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0 }, p1: -1, p2: -1 };
        gl.parts.push(part);
        part.glyphIndex = bin.readUshort(data, offset);
        offset += 2;
        if (flags & ARG_1_AND_2_ARE_WORDS) {
          var arg1 = bin.readShort(data, offset);
          offset += 2;
          var arg2 = bin.readShort(data, offset);
          offset += 2;
        } else {
          var arg1 = bin.readInt8(data, offset);
          offset++;
          var arg2 = bin.readInt8(data, offset);
          offset++;
        }
        if (flags & ARGS_ARE_XY_VALUES) {
          part.m.tx = arg1;
          part.m.ty = arg2;
        } else {
          part.p1 = arg1;
          part.p2 = arg2;
        }
        if (flags & WE_HAVE_A_SCALE) {
          part.m.a = part.m.d = bin.readF2dot14(data, offset);
          offset += 2;
        } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
          part.m.a = bin.readF2dot14(data, offset);
          offset += 2;
          part.m.d = bin.readF2dot14(data, offset);
          offset += 2;
        } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
          part.m.a = bin.readF2dot14(data, offset);
          offset += 2;
          part.m.b = bin.readF2dot14(data, offset);
          offset += 2;
          part.m.c = bin.readF2dot14(data, offset);
          offset += 2;
          part.m.d = bin.readF2dot14(data, offset);
          offset += 2;
        }
      } while (flags & MORE_COMPONENTS);
      if (flags & WE_HAVE_INSTRUCTIONS) {
        var numInstr = bin.readUshort(data, offset);
        offset += 2;
        gl.instr = [];
        for (var i = 0; i < numInstr; i++) {
          gl.instr.push(data[offset]);
          offset++;
        }
      }
    }
    return gl;
  };
  Typr.GPOS = {};
  Typr.GPOS.parse = function(data, offset, length, font) {
    return Typr._lctf.parse(data, offset, length, font, Typr.GPOS.subt);
  };
  Typr.GPOS.subt = function(data, ltype, offset) {
    if (ltype != 2)
      return null;
    var bin = Typr._bin, offset0 = offset, tab = {};
    tab.format = bin.readUshort(data, offset);
    offset += 2;
    var covOff = bin.readUshort(data, offset);
    offset += 2;
    tab.coverage = Typr._lctf.readCoverage(data, covOff + offset0);
    tab.valFmt1 = bin.readUshort(data, offset);
    offset += 2;
    tab.valFmt2 = bin.readUshort(data, offset);
    offset += 2;
    var ones1 = Typr._lctf.numOfOnes(tab.valFmt1);
    var ones2 = Typr._lctf.numOfOnes(tab.valFmt2);
    if (tab.format == 1) {
      tab.pairsets = [];
      var count = bin.readUshort(data, offset);
      offset += 2;
      for (var i = 0; i < count; i++) {
        var psoff = bin.readUshort(data, offset);
        offset += 2;
        psoff += offset0;
        var pvcount = bin.readUshort(data, psoff);
        psoff += 2;
        var arr = [];
        for (var j = 0; j < pvcount; j++) {
          var gid2 = bin.readUshort(data, psoff);
          psoff += 2;
          var value1, value2;
          if (tab.valFmt1 != 0) {
            value1 = Typr._lctf.readValueRecord(data, psoff, tab.valFmt1);
            psoff += ones1 * 2;
          }
          if (tab.valFmt2 != 0) {
            value2 = Typr._lctf.readValueRecord(data, psoff, tab.valFmt2);
            psoff += ones2 * 2;
          }
          arr.push({ gid2, val1: value1, val2: value2 });
        }
        tab.pairsets.push(arr);
      }
    }
    if (tab.format == 2) {
      var classDef1 = bin.readUshort(data, offset);
      offset += 2;
      var classDef2 = bin.readUshort(data, offset);
      offset += 2;
      var class1Count = bin.readUshort(data, offset);
      offset += 2;
      var class2Count = bin.readUshort(data, offset);
      offset += 2;
      tab.classDef1 = Typr._lctf.readClassDef(data, offset0 + classDef1);
      tab.classDef2 = Typr._lctf.readClassDef(data, offset0 + classDef2);
      tab.matrix = [];
      for (var i = 0; i < class1Count; i++) {
        var row = [];
        for (var j = 0; j < class2Count; j++) {
          var value1 = null, value2 = null;
          if (tab.valFmt1 != 0) {
            value1 = Typr._lctf.readValueRecord(data, offset, tab.valFmt1);
            offset += ones1 * 2;
          }
          if (tab.valFmt2 != 0) {
            value2 = Typr._lctf.readValueRecord(data, offset, tab.valFmt2);
            offset += ones2 * 2;
          }
          row.push({ val1: value1, val2: value2 });
        }
        tab.matrix.push(row);
      }
    }
    return tab;
  };
  Typr.GSUB = {};
  Typr.GSUB.parse = function(data, offset, length, font) {
    return Typr._lctf.parse(data, offset, length, font, Typr.GSUB.subt);
  };
  Typr.GSUB.subt = function(data, ltype, offset) {
    var bin = Typr._bin, offset0 = offset, tab = {};
    if (ltype != 1 && ltype != 4 && ltype != 5)
      return null;
    tab.fmt = bin.readUshort(data, offset);
    offset += 2;
    var covOff = bin.readUshort(data, offset);
    offset += 2;
    tab.coverage = Typr._lctf.readCoverage(data, covOff + offset0);
    if (ltype == 1) {
      if (tab.fmt == 1) {
        tab.delta = bin.readShort(data, offset);
        offset += 2;
      } else if (tab.fmt == 2) {
        var cnt = bin.readUshort(data, offset);
        offset += 2;
        tab.newg = bin.readUshorts(data, offset, cnt);
        offset += tab.newg.length * 2;
      }
    } else if (ltype == 4) {
      tab.vals = [];
      var cnt = bin.readUshort(data, offset);
      offset += 2;
      for (var i = 0; i < cnt; i++) {
        var loff = bin.readUshort(data, offset);
        offset += 2;
        tab.vals.push(Typr.GSUB.readLigatureSet(data, offset0 + loff));
      }
    } else if (ltype == 5) {
      if (tab.fmt == 2) {
        var cDefOffset = bin.readUshort(data, offset);
        offset += 2;
        tab.cDef = Typr._lctf.readClassDef(data, offset0 + cDefOffset);
        tab.scset = [];
        var subClassSetCount = bin.readUshort(data, offset);
        offset += 2;
        for (var i = 0; i < subClassSetCount; i++) {
          var scsOff = bin.readUshort(data, offset);
          offset += 2;
          tab.scset.push(scsOff == 0 ? null : Typr.GSUB.readSubClassSet(data, offset0 + scsOff));
        }
      } else
        console.log("unknown table format", tab.fmt);
    }
    return tab;
  };
  Typr.GSUB.readSubClassSet = function(data, offset) {
    var rUs = Typr._bin.readUshort, offset0 = offset, lset = [];
    var cnt = rUs(data, offset);
    offset += 2;
    for (var i = 0; i < cnt; i++) {
      var loff = rUs(data, offset);
      offset += 2;
      lset.push(Typr.GSUB.readSubClassRule(data, offset0 + loff));
    }
    return lset;
  };
  Typr.GSUB.readSubClassRule = function(data, offset) {
    var rUs = Typr._bin.readUshort, rule = {};
    var gcount = rUs(data, offset);
    offset += 2;
    var scount = rUs(data, offset);
    offset += 2;
    rule.input = [];
    for (var i = 0; i < gcount - 1; i++) {
      rule.input.push(rUs(data, offset));
      offset += 2;
    }
    rule.substLookupRecords = Typr.GSUB.readSubstLookupRecords(data, offset, scount);
    return rule;
  };
  Typr.GSUB.readSubstLookupRecords = function(data, offset, cnt) {
    var rUs = Typr._bin.readUshort;
    var out = [];
    for (var i = 0; i < cnt; i++) {
      out.push(rUs(data, offset), rUs(data, offset + 2));
      offset += 4;
    }
    return out;
  };
  Typr.GSUB.readChainSubClassSet = function(data, offset) {
    var bin = Typr._bin, offset0 = offset, lset = [];
    var cnt = bin.readUshort(data, offset);
    offset += 2;
    for (var i = 0; i < cnt; i++) {
      var loff = bin.readUshort(data, offset);
      offset += 2;
      lset.push(Typr.GSUB.readChainSubClassRule(data, offset0 + loff));
    }
    return lset;
  };
  Typr.GSUB.readChainSubClassRule = function(data, offset) {
    var bin = Typr._bin, rule = {};
    var pps = ["backtrack", "input", "lookahead"];
    for (var pi = 0; pi < pps.length; pi++) {
      var cnt = bin.readUshort(data, offset);
      offset += 2;
      if (pi == 1)
        cnt--;
      rule[pps[pi]] = bin.readUshorts(data, offset, cnt);
      offset += rule[pps[pi]].length * 2;
    }
    var cnt = bin.readUshort(data, offset);
    offset += 2;
    rule.subst = bin.readUshorts(data, offset, cnt * 2);
    offset += rule.subst.length * 2;
    return rule;
  };
  Typr.GSUB.readLigatureSet = function(data, offset) {
    var bin = Typr._bin, offset0 = offset, lset = [];
    var lcnt = bin.readUshort(data, offset);
    offset += 2;
    for (var j = 0; j < lcnt; j++) {
      var loff = bin.readUshort(data, offset);
      offset += 2;
      lset.push(Typr.GSUB.readLigature(data, offset0 + loff));
    }
    return lset;
  };
  Typr.GSUB.readLigature = function(data, offset) {
    var bin = Typr._bin, lig = { chain: [] };
    lig.nglyph = bin.readUshort(data, offset);
    offset += 2;
    var ccnt = bin.readUshort(data, offset);
    offset += 2;
    for (var k = 0; k < ccnt - 1; k++) {
      lig.chain.push(bin.readUshort(data, offset));
      offset += 2;
    }
    return lig;
  };
  Typr.head = {};
  Typr.head.parse = function(data, offset, length) {
    var bin = Typr._bin;
    var obj = {};
    bin.readFixed(data, offset);
    offset += 4;
    obj.fontRevision = bin.readFixed(data, offset);
    offset += 4;
    bin.readUint(data, offset);
    offset += 4;
    bin.readUint(data, offset);
    offset += 4;
    obj.flags = bin.readUshort(data, offset);
    offset += 2;
    obj.unitsPerEm = bin.readUshort(data, offset);
    offset += 2;
    obj.created = bin.readUint64(data, offset);
    offset += 8;
    obj.modified = bin.readUint64(data, offset);
    offset += 8;
    obj.xMin = bin.readShort(data, offset);
    offset += 2;
    obj.yMin = bin.readShort(data, offset);
    offset += 2;
    obj.xMax = bin.readShort(data, offset);
    offset += 2;
    obj.yMax = bin.readShort(data, offset);
    offset += 2;
    obj.macStyle = bin.readUshort(data, offset);
    offset += 2;
    obj.lowestRecPPEM = bin.readUshort(data, offset);
    offset += 2;
    obj.fontDirectionHint = bin.readShort(data, offset);
    offset += 2;
    obj.indexToLocFormat = bin.readShort(data, offset);
    offset += 2;
    obj.glyphDataFormat = bin.readShort(data, offset);
    offset += 2;
    return obj;
  };
  Typr.hhea = {};
  Typr.hhea.parse = function(data, offset, length) {
    var bin = Typr._bin;
    var obj = {};
    bin.readFixed(data, offset);
    offset += 4;
    obj.ascender = bin.readShort(data, offset);
    offset += 2;
    obj.descender = bin.readShort(data, offset);
    offset += 2;
    obj.lineGap = bin.readShort(data, offset);
    offset += 2;
    obj.advanceWidthMax = bin.readUshort(data, offset);
    offset += 2;
    obj.minLeftSideBearing = bin.readShort(data, offset);
    offset += 2;
    obj.minRightSideBearing = bin.readShort(data, offset);
    offset += 2;
    obj.xMaxExtent = bin.readShort(data, offset);
    offset += 2;
    obj.caretSlopeRise = bin.readShort(data, offset);
    offset += 2;
    obj.caretSlopeRun = bin.readShort(data, offset);
    offset += 2;
    obj.caretOffset = bin.readShort(data, offset);
    offset += 2;
    offset += 4 * 2;
    obj.metricDataFormat = bin.readShort(data, offset);
    offset += 2;
    obj.numberOfHMetrics = bin.readUshort(data, offset);
    offset += 2;
    return obj;
  };
  Typr.hmtx = {};
  Typr.hmtx.parse = function(data, offset, length, font) {
    var bin = Typr._bin;
    var obj = {};
    obj.aWidth = [];
    obj.lsBearing = [];
    var aw = 0, lsb = 0;
    for (var i = 0; i < font.maxp.numGlyphs; i++) {
      if (i < font.hhea.numberOfHMetrics) {
        aw = bin.readUshort(data, offset);
        offset += 2;
        lsb = bin.readShort(data, offset);
        offset += 2;
      }
      obj.aWidth.push(aw);
      obj.lsBearing.push(lsb);
    }
    return obj;
  };
  Typr.kern = {};
  Typr.kern.parse = function(data, offset, length, font) {
    var bin = Typr._bin;
    var version = bin.readUshort(data, offset);
    offset += 2;
    if (version == 1)
      return Typr.kern.parseV1(data, offset - 2, length, font);
    var nTables = bin.readUshort(data, offset);
    offset += 2;
    var map = { glyph1: [], rval: [] };
    for (var i = 0; i < nTables; i++) {
      offset += 2;
      var length = bin.readUshort(data, offset);
      offset += 2;
      var coverage = bin.readUshort(data, offset);
      offset += 2;
      var format = coverage >>> 8;
      format &= 15;
      if (format == 0)
        offset = Typr.kern.readFormat0(data, offset, map);
      else
        throw "unknown kern table format: " + format;
    }
    return map;
  };
  Typr.kern.parseV1 = function(data, offset, length, font) {
    var bin = Typr._bin;
    bin.readFixed(data, offset);
    offset += 4;
    var nTables = bin.readUint(data, offset);
    offset += 4;
    var map = { glyph1: [], rval: [] };
    for (var i = 0; i < nTables; i++) {
      bin.readUint(data, offset);
      offset += 4;
      var coverage = bin.readUshort(data, offset);
      offset += 2;
      bin.readUshort(data, offset);
      offset += 2;
      var format = coverage >>> 8;
      format &= 15;
      if (format == 0)
        offset = Typr.kern.readFormat0(data, offset, map);
      else
        throw "unknown kern table format: " + format;
    }
    return map;
  };
  Typr.kern.readFormat0 = function(data, offset, map) {
    var bin = Typr._bin;
    var pleft = -1;
    var nPairs = bin.readUshort(data, offset);
    offset += 2;
    bin.readUshort(data, offset);
    offset += 2;
    bin.readUshort(data, offset);
    offset += 2;
    bin.readUshort(data, offset);
    offset += 2;
    for (var j = 0; j < nPairs; j++) {
      var left = bin.readUshort(data, offset);
      offset += 2;
      var right = bin.readUshort(data, offset);
      offset += 2;
      var value = bin.readShort(data, offset);
      offset += 2;
      if (left != pleft) {
        map.glyph1.push(left);
        map.rval.push({ glyph2: [], vals: [] });
      }
      var rval = map.rval[map.rval.length - 1];
      rval.glyph2.push(right);
      rval.vals.push(value);
      pleft = left;
    }
    return offset;
  };
  Typr.loca = {};
  Typr.loca.parse = function(data, offset, length, font) {
    var bin = Typr._bin;
    var obj = [];
    var ver = font.head.indexToLocFormat;
    var len = font.maxp.numGlyphs + 1;
    if (ver == 0)
      for (var i = 0; i < len; i++)
        obj.push(bin.readUshort(data, offset + (i << 1)) << 1);
    if (ver == 1)
      for (var i = 0; i < len; i++)
        obj.push(bin.readUint(data, offset + (i << 2)));
    return obj;
  };
  Typr.maxp = {};
  Typr.maxp.parse = function(data, offset, length) {
    var bin = Typr._bin;
    var obj = {};
    var ver = bin.readUint(data, offset);
    offset += 4;
    obj.numGlyphs = bin.readUshort(data, offset);
    offset += 2;
    if (ver == 65536) {
      obj.maxPoints = bin.readUshort(data, offset);
      offset += 2;
      obj.maxContours = bin.readUshort(data, offset);
      offset += 2;
      obj.maxCompositePoints = bin.readUshort(data, offset);
      offset += 2;
      obj.maxCompositeContours = bin.readUshort(data, offset);
      offset += 2;
      obj.maxZones = bin.readUshort(data, offset);
      offset += 2;
      obj.maxTwilightPoints = bin.readUshort(data, offset);
      offset += 2;
      obj.maxStorage = bin.readUshort(data, offset);
      offset += 2;
      obj.maxFunctionDefs = bin.readUshort(data, offset);
      offset += 2;
      obj.maxInstructionDefs = bin.readUshort(data, offset);
      offset += 2;
      obj.maxStackElements = bin.readUshort(data, offset);
      offset += 2;
      obj.maxSizeOfInstructions = bin.readUshort(data, offset);
      offset += 2;
      obj.maxComponentElements = bin.readUshort(data, offset);
      offset += 2;
      obj.maxComponentDepth = bin.readUshort(data, offset);
      offset += 2;
    }
    return obj;
  };
  Typr.name = {};
  Typr.name.parse = function(data, offset, length) {
    var bin = Typr._bin;
    var obj = {};
    bin.readUshort(data, offset);
    offset += 2;
    var count = bin.readUshort(data, offset);
    offset += 2;
    bin.readUshort(data, offset);
    offset += 2;
    var offset0 = offset;
    for (var i = 0; i < count; i++) {
      var platformID = bin.readUshort(data, offset);
      offset += 2;
      var encodingID = bin.readUshort(data, offset);
      offset += 2;
      var languageID = bin.readUshort(data, offset);
      offset += 2;
      var nameID = bin.readUshort(data, offset);
      offset += 2;
      var length = bin.readUshort(data, offset);
      offset += 2;
      var noffset = bin.readUshort(data, offset);
      offset += 2;
      var plat = "p" + platformID;
      if (obj[plat] == null)
        obj[plat] = {};
      var names = ["copyright", "fontFamily", "fontSubfamily", "ID", "fullName", "version", "postScriptName", "trademark", "manufacturer", "designer", "description", "urlVendor", "urlDesigner", "licence", "licenceURL", "---", "typoFamilyName", "typoSubfamilyName", "compatibleFull", "sampleText", "postScriptCID", "wwsFamilyName", "wwsSubfamilyName", "lightPalette", "darkPalette"];
      var cname = names[nameID];
      var soff = offset0 + count * 12 + noffset;
      var str;
      if (platformID == 0)
        str = bin.readUnicode(data, soff, length / 2);
      else if (platformID == 3 && encodingID == 0)
        str = bin.readUnicode(data, soff, length / 2);
      else if (encodingID == 0)
        str = bin.readASCII(data, soff, length);
      else if (encodingID == 1)
        str = bin.readUnicode(data, soff, length / 2);
      else if (encodingID == 3)
        str = bin.readUnicode(data, soff, length / 2);
      else if (platformID == 1) {
        str = bin.readASCII(data, soff, length);
        console.log("reading unknown MAC encoding " + encodingID + " as ASCII");
      } else
        throw "unknown encoding " + encodingID + ", platformID: " + platformID;
      obj[plat][cname] = str;
      obj[plat]._lang = languageID;
    }
    for (var p in obj)
      if (obj[p].postScriptName != null && obj[p]._lang == 1033)
        return obj[p];
    for (var p in obj)
      if (obj[p].postScriptName != null && obj[p]._lang == 3084)
        return obj[p];
    for (var p in obj)
      if (obj[p].postScriptName != null)
        return obj[p];
    var tname;
    for (var p in obj) {
      tname = p;
      break;
    }
    console.log("returning name table with languageID " + obj[tname]._lang);
    return obj[tname];
  };
  Typr["OS/2"] = {};
  Typr["OS/2"].parse = function(data, offset, length) {
    var bin = Typr._bin;
    var ver = bin.readUshort(data, offset);
    offset += 2;
    var obj = {};
    if (ver == 0)
      Typr["OS/2"].version0(data, offset, obj);
    else if (ver == 1)
      Typr["OS/2"].version1(data, offset, obj);
    else if (ver == 2 || ver == 3 || ver == 4)
      Typr["OS/2"].version2(data, offset, obj);
    else if (ver == 5)
      Typr["OS/2"].version5(data, offset, obj);
    else
      throw "unknown OS/2 table version: " + ver;
    return obj;
  };
  Typr["OS/2"].version0 = function(data, offset, obj) {
    var bin = Typr._bin;
    obj.xAvgCharWidth = bin.readShort(data, offset);
    offset += 2;
    obj.usWeightClass = bin.readUshort(data, offset);
    offset += 2;
    obj.usWidthClass = bin.readUshort(data, offset);
    offset += 2;
    obj.fsType = bin.readUshort(data, offset);
    offset += 2;
    obj.ySubscriptXSize = bin.readShort(data, offset);
    offset += 2;
    obj.ySubscriptYSize = bin.readShort(data, offset);
    offset += 2;
    obj.ySubscriptXOffset = bin.readShort(data, offset);
    offset += 2;
    obj.ySubscriptYOffset = bin.readShort(data, offset);
    offset += 2;
    obj.ySuperscriptXSize = bin.readShort(data, offset);
    offset += 2;
    obj.ySuperscriptYSize = bin.readShort(data, offset);
    offset += 2;
    obj.ySuperscriptXOffset = bin.readShort(data, offset);
    offset += 2;
    obj.ySuperscriptYOffset = bin.readShort(data, offset);
    offset += 2;
    obj.yStrikeoutSize = bin.readShort(data, offset);
    offset += 2;
    obj.yStrikeoutPosition = bin.readShort(data, offset);
    offset += 2;
    obj.sFamilyClass = bin.readShort(data, offset);
    offset += 2;
    obj.panose = bin.readBytes(data, offset, 10);
    offset += 10;
    obj.ulUnicodeRange1 = bin.readUint(data, offset);
    offset += 4;
    obj.ulUnicodeRange2 = bin.readUint(data, offset);
    offset += 4;
    obj.ulUnicodeRange3 = bin.readUint(data, offset);
    offset += 4;
    obj.ulUnicodeRange4 = bin.readUint(data, offset);
    offset += 4;
    obj.achVendID = [bin.readInt8(data, offset), bin.readInt8(data, offset + 1), bin.readInt8(data, offset + 2), bin.readInt8(data, offset + 3)];
    offset += 4;
    obj.fsSelection = bin.readUshort(data, offset);
    offset += 2;
    obj.usFirstCharIndex = bin.readUshort(data, offset);
    offset += 2;
    obj.usLastCharIndex = bin.readUshort(data, offset);
    offset += 2;
    obj.sTypoAscender = bin.readShort(data, offset);
    offset += 2;
    obj.sTypoDescender = bin.readShort(data, offset);
    offset += 2;
    obj.sTypoLineGap = bin.readShort(data, offset);
    offset += 2;
    obj.usWinAscent = bin.readUshort(data, offset);
    offset += 2;
    obj.usWinDescent = bin.readUshort(data, offset);
    offset += 2;
    return offset;
  };
  Typr["OS/2"].version1 = function(data, offset, obj) {
    var bin = Typr._bin;
    offset = Typr["OS/2"].version0(data, offset, obj);
    obj.ulCodePageRange1 = bin.readUint(data, offset);
    offset += 4;
    obj.ulCodePageRange2 = bin.readUint(data, offset);
    offset += 4;
    return offset;
  };
  Typr["OS/2"].version2 = function(data, offset, obj) {
    var bin = Typr._bin;
    offset = Typr["OS/2"].version1(data, offset, obj);
    obj.sxHeight = bin.readShort(data, offset);
    offset += 2;
    obj.sCapHeight = bin.readShort(data, offset);
    offset += 2;
    obj.usDefault = bin.readUshort(data, offset);
    offset += 2;
    obj.usBreak = bin.readUshort(data, offset);
    offset += 2;
    obj.usMaxContext = bin.readUshort(data, offset);
    offset += 2;
    return offset;
  };
  Typr["OS/2"].version5 = function(data, offset, obj) {
    var bin = Typr._bin;
    offset = Typr["OS/2"].version2(data, offset, obj);
    obj.usLowerOpticalPointSize = bin.readUshort(data, offset);
    offset += 2;
    obj.usUpperOpticalPointSize = bin.readUshort(data, offset);
    offset += 2;
    return offset;
  };
  Typr.post = {};
  Typr.post.parse = function(data, offset, length) {
    var bin = Typr._bin;
    var obj = {};
    obj.version = bin.readFixed(data, offset);
    offset += 4;
    obj.italicAngle = bin.readFixed(data, offset);
    offset += 4;
    obj.underlinePosition = bin.readShort(data, offset);
    offset += 2;
    obj.underlineThickness = bin.readShort(data, offset);
    offset += 2;
    return obj;
  };
  Typr.SVG = {};
  Typr.SVG.parse = function(data, offset, length) {
    var bin = Typr._bin;
    var obj = { entries: [] };
    var offset0 = offset;
    bin.readUshort(data, offset);
    offset += 2;
    var svgDocIndexOffset = bin.readUint(data, offset);
    offset += 4;
    bin.readUint(data, offset);
    offset += 4;
    offset = svgDocIndexOffset + offset0;
    var numEntries = bin.readUshort(data, offset);
    offset += 2;
    for (var i = 0; i < numEntries; i++) {
      var startGlyphID = bin.readUshort(data, offset);
      offset += 2;
      var endGlyphID = bin.readUshort(data, offset);
      offset += 2;
      var svgDocOffset = bin.readUint(data, offset);
      offset += 4;
      var svgDocLength = bin.readUint(data, offset);
      offset += 4;
      var sbuf = new Uint8Array(data.buffer, offset0 + svgDocOffset + svgDocIndexOffset, svgDocLength);
      var svg2 = bin.readUTF8(sbuf, 0, sbuf.length);
      for (var f = startGlyphID; f <= endGlyphID; f++) {
        obj.entries[f] = svg2;
      }
    }
    return obj;
  };
  Typr.SVG.toPath = function(str) {
    var pth = { cmds: [], crds: [] };
    if (str == null)
      return pth;
    var prsr = new DOMParser();
    var doc = prsr["parseFromString"](str, "image/svg+xml");
    var svg2 = doc.firstChild;
    while (svg2.tagName != "svg")
      svg2 = svg2.nextSibling;
    var vb = svg2.getAttribute("viewBox");
    if (vb)
      vb = vb.trim().split(" ").map(parseFloat);
    else
      vb = [0, 0, 1e3, 1e3];
    Typr.SVG._toPath(svg2.children, pth);
    for (var i = 0; i < pth.crds.length; i += 2) {
      var x = pth.crds[i], y = pth.crds[i + 1];
      x -= vb[0];
      y -= vb[1];
      y = -y;
      pth.crds[i] = x;
      pth.crds[i + 1] = y;
    }
    return pth;
  };
  Typr.SVG._toPath = function(nds, pth, fill) {
    for (var ni = 0; ni < nds.length; ni++) {
      var nd = nds[ni], tn = nd.tagName;
      var cfl = nd.getAttribute("fill");
      if (cfl == null)
        cfl = fill;
      if (tn == "g")
        Typr.SVG._toPath(nd.children, pth, cfl);
      else if (tn == "path") {
        pth.cmds.push(cfl ? cfl : "#000000");
        var d = nd.getAttribute("d");
        var toks = Typr.SVG._tokens(d);
        Typr.SVG._toksToPath(toks, pth);
        pth.cmds.push("X");
      } else if (tn == "defs")
        ;
      else
        console.log(tn, nd);
    }
  };
  Typr.SVG._tokens = function(d) {
    var ts = [], off = 0, rn = false, cn = "";
    while (off < d.length) {
      var cc = d.charCodeAt(off), ch = d.charAt(off);
      off++;
      var isNum = 48 <= cc && cc <= 57 || ch == "." || ch == "-";
      if (rn) {
        if (ch == "-") {
          ts.push(parseFloat(cn));
          cn = ch;
        } else if (isNum)
          cn += ch;
        else {
          ts.push(parseFloat(cn));
          if (ch != "," && ch != " ")
            ts.push(ch);
          rn = false;
        }
      } else {
        if (isNum) {
          cn = ch;
          rn = true;
        } else if (ch != "," && ch != " ")
          ts.push(ch);
      }
    }
    if (rn)
      ts.push(parseFloat(cn));
    return ts;
  };
  Typr.SVG._toksToPath = function(ts, pth) {
    var i = 0, x = 0, y = 0, ox = 0, oy = 0;
    var pc = { M: 2, L: 2, H: 1, V: 1, S: 4, C: 6 };
    var cmds = pth.cmds, crds = pth.crds;
    while (i < ts.length) {
      var cmd = ts[i];
      i++;
      if (cmd == "z") {
        cmds.push("Z");
        x = ox;
        y = oy;
      } else {
        var cmu = cmd.toUpperCase();
        var ps = pc[cmu], reps = Typr.SVG._reps(ts, i, ps);
        for (var j = 0; j < reps; j++) {
          var xi = 0, yi = 0;
          if (cmd != cmu) {
            xi = x;
            yi = y;
          }
          if (cmu == "M") {
            x = xi + ts[i++];
            y = yi + ts[i++];
            cmds.push("M");
            crds.push(x, y);
            ox = x;
            oy = y;
          } else if (cmu == "L") {
            x = xi + ts[i++];
            y = yi + ts[i++];
            cmds.push("L");
            crds.push(x, y);
          } else if (cmu == "H") {
            x = xi + ts[i++];
            cmds.push("L");
            crds.push(x, y);
          } else if (cmu == "V") {
            y = yi + ts[i++];
            cmds.push("L");
            crds.push(x, y);
          } else if (cmu == "C") {
            var x1 = xi + ts[i++], y1 = yi + ts[i++], x2 = xi + ts[i++], y2 = yi + ts[i++], x3 = xi + ts[i++], y3 = yi + ts[i++];
            cmds.push("C");
            crds.push(x1, y1, x2, y2, x3, y3);
            x = x3;
            y = y3;
          } else if (cmu == "S") {
            var co = Math.max(crds.length - 4, 0);
            var x1 = x + x - crds[co], y1 = y + y - crds[co + 1];
            var x2 = xi + ts[i++], y2 = yi + ts[i++], x3 = xi + ts[i++], y3 = yi + ts[i++];
            cmds.push("C");
            crds.push(x1, y1, x2, y2, x3, y3);
            x = x3;
            y = y3;
          } else
            console.log("Unknown SVG command " + cmd);
        }
      }
    }
  };
  Typr.SVG._reps = function(ts, off, ps) {
    var i = off;
    while (i < ts.length) {
      if (typeof ts[i] == "string")
        break;
      i += ps;
    }
    return (i - off) / ps;
  };
  if (Typr == null)
    Typr = {};
  if (Typr.U == null)
    Typr.U = {};
  Typr.U.codeToGlyph = function(font, code) {
    var cmap = font.cmap;
    var tind = -1;
    if (cmap.p0e4 != null)
      tind = cmap.p0e4;
    else if (cmap.p3e1 != null)
      tind = cmap.p3e1;
    else if (cmap.p1e0 != null)
      tind = cmap.p1e0;
    if (tind == -1)
      throw "no familiar platform and encoding!";
    var tab = cmap.tables[tind];
    if (tab.format == 0) {
      if (code >= tab.map.length)
        return 0;
      return tab.map[code];
    } else if (tab.format == 4) {
      var sind = -1;
      for (var i = 0; i < tab.endCount.length; i++)
        if (code <= tab.endCount[i]) {
          sind = i;
          break;
        }
      if (sind == -1)
        return 0;
      if (tab.startCount[sind] > code)
        return 0;
      var gli = 0;
      if (tab.idRangeOffset[sind] != 0)
        gli = tab.glyphIdArray[code - tab.startCount[sind] + (tab.idRangeOffset[sind] >> 1) - (tab.idRangeOffset.length - sind)];
      else
        gli = code + tab.idDelta[sind];
      return gli & 65535;
    } else if (tab.format == 12) {
      if (code > tab.groups[tab.groups.length - 1][1])
        return 0;
      for (var i = 0; i < tab.groups.length; i++) {
        var grp = tab.groups[i];
        if (grp[0] <= code && code <= grp[1])
          return grp[2] + (code - grp[0]);
      }
      return 0;
    } else
      throw "unknown cmap table format " + tab.format;
  };
  Typr.U.glyphToPath = function(font, gid) {
    var path = { cmds: [], crds: [] };
    if (font.SVG && font.SVG.entries[gid]) {
      var p = font.SVG.entries[gid];
      if (p == null)
        return path;
      if (typeof p == "string") {
        p = Typr.SVG.toPath(p);
        font.SVG.entries[gid] = p;
      }
      return p;
    } else if (font.CFF) {
      var state = { x: 0, y: 0, stack: [], nStems: 0, haveWidth: false, width: font.CFF.Private ? font.CFF.Private.defaultWidthX : 0, open: false };
      Typr.U._drawCFF(font.CFF.CharStrings[gid], state, font.CFF, path);
    } else if (font.glyf) {
      Typr.U._drawGlyf(gid, font, path);
    }
    return path;
  };
  Typr.U._drawGlyf = function(gid, font, path) {
    var gl = font.glyf[gid];
    if (gl == null)
      gl = font.glyf[gid] = Typr.glyf._parseGlyf(font, gid);
    if (gl != null) {
      if (gl.noc > -1)
        Typr.U._simpleGlyph(gl, path);
      else
        Typr.U._compoGlyph(gl, font, path);
    }
  };
  Typr.U._simpleGlyph = function(gl, p) {
    for (var c = 0; c < gl.noc; c++) {
      var i0 = c == 0 ? 0 : gl.endPts[c - 1] + 1;
      var il = gl.endPts[c];
      for (var i = i0; i <= il; i++) {
        var pr = i == i0 ? il : i - 1;
        var nx = i == il ? i0 : i + 1;
        var onCurve = gl.flags[i] & 1;
        var prOnCurve = gl.flags[pr] & 1;
        var nxOnCurve = gl.flags[nx] & 1;
        var x = gl.xs[i], y = gl.ys[i];
        if (i == i0) {
          if (onCurve) {
            if (prOnCurve)
              Typr.U.P.moveTo(p, gl.xs[pr], gl.ys[pr]);
            else {
              Typr.U.P.moveTo(p, x, y);
              continue;
            }
          } else {
            if (prOnCurve)
              Typr.U.P.moveTo(p, gl.xs[pr], gl.ys[pr]);
            else
              Typr.U.P.moveTo(p, (gl.xs[pr] + x) / 2, (gl.ys[pr] + y) / 2);
          }
        }
        if (onCurve) {
          if (prOnCurve)
            Typr.U.P.lineTo(p, x, y);
        } else {
          if (nxOnCurve)
            Typr.U.P.qcurveTo(p, x, y, gl.xs[nx], gl.ys[nx]);
          else
            Typr.U.P.qcurveTo(p, x, y, (x + gl.xs[nx]) / 2, (y + gl.ys[nx]) / 2);
        }
      }
      Typr.U.P.closePath(p);
    }
  };
  Typr.U._compoGlyph = function(gl, font, p) {
    for (var j = 0; j < gl.parts.length; j++) {
      var path = { cmds: [], crds: [] };
      var prt = gl.parts[j];
      Typr.U._drawGlyf(prt.glyphIndex, font, path);
      var m = prt.m;
      for (var i = 0; i < path.crds.length; i += 2) {
        var x = path.crds[i], y = path.crds[i + 1];
        p.crds.push(x * m.a + y * m.b + m.tx);
        p.crds.push(x * m.c + y * m.d + m.ty);
      }
      for (var i = 0; i < path.cmds.length; i++)
        p.cmds.push(path.cmds[i]);
    }
  };
  Typr.U._getGlyphClass = function(g, cd) {
    var intr = Typr._lctf.getInterval(cd, g);
    return intr == -1 ? 0 : cd[intr + 2];
  };
  Typr.U.getPairAdjustment = function(font, g1, g2) {
    if (font.GPOS) {
      var ltab = null;
      for (var i = 0; i < font.GPOS.featureList.length; i++) {
        var fl = font.GPOS.featureList[i];
        if (fl.tag == "kern") {
          for (var j = 0; j < fl.tab.length; j++)
            if (font.GPOS.lookupList[fl.tab[j]].ltype == 2)
              ltab = font.GPOS.lookupList[fl.tab[j]];
        }
      }
      if (ltab) {
        for (var i = 0; i < ltab.tabs.length; i++) {
          var tab = ltab.tabs[i];
          var ind = Typr._lctf.coverageIndex(tab.coverage, g1);
          if (ind == -1)
            continue;
          var adj;
          if (tab.format == 1) {
            var right = tab.pairsets[ind];
            for (var j = 0; j < right.length; j++)
              if (right[j].gid2 == g2)
                adj = right[j];
            if (adj == null)
              continue;
          } else if (tab.format == 2) {
            var c1 = Typr.U._getGlyphClass(g1, tab.classDef1);
            var c2 = Typr.U._getGlyphClass(g2, tab.classDef2);
            var adj = tab.matrix[c1][c2];
          }
          return adj.val1[2];
        }
      }
    }
    if (font.kern) {
      var ind1 = font.kern.glyph1.indexOf(g1);
      if (ind1 != -1) {
        var ind2 = font.kern.rval[ind1].glyph2.indexOf(g2);
        if (ind2 != -1)
          return font.kern.rval[ind1].vals[ind2];
      }
    }
    return 0;
  };
  Typr.U.stringToGlyphs = function(font, str) {
    var gls = [];
    for (var i = 0; i < str.length; i++) {
      var cc = str.codePointAt(i);
      if (cc > 65535)
        i++;
      gls.push(Typr.U.codeToGlyph(font, cc));
    }
    var gsub = font["GSUB"];
    if (gsub == null)
      return gls;
    var llist = gsub.lookupList, flist = gsub.featureList;
    var wsep = '\n	" ,.:;!?()  ،';
    var R = "آأؤإاةدذرزوٱٲٳٵٶٷڈډڊڋڌڍڎڏڐڑڒړڔڕږڗژڙۀۃۄۅۆۇۈۉۊۋۍۏےۓەۮۯܐܕܖܗܘܙܞܨܪܬܯݍݙݚݛݫݬݱݳݴݸݹࡀࡆࡇࡉࡔࡧࡩࡪࢪࢫࢬࢮࢱࢲࢹૅેૉ૊૎૏ૐ૑૒૝ૡ૤૯஁ஃ஄அஉ஌எஏ஑னப஫஬";
    var L = "ꡲ્૗";
    for (var ci = 0; ci < gls.length; ci++) {
      var gl = gls[ci];
      var slft = ci == 0 || wsep.indexOf(str[ci - 1]) != -1;
      var srgt = ci == gls.length - 1 || wsep.indexOf(str[ci + 1]) != -1;
      if (!slft && R.indexOf(str[ci - 1]) != -1)
        slft = true;
      if (!srgt && R.indexOf(str[ci]) != -1)
        srgt = true;
      if (!srgt && L.indexOf(str[ci + 1]) != -1)
        srgt = true;
      if (!slft && L.indexOf(str[ci]) != -1)
        slft = true;
      var feat = null;
      if (slft)
        feat = srgt ? "isol" : "init";
      else
        feat = srgt ? "fina" : "medi";
      for (var fi = 0; fi < flist.length; fi++) {
        if (flist[fi].tag != feat)
          continue;
        for (var ti = 0; ti < flist[fi].tab.length; ti++) {
          var tab = llist[flist[fi].tab[ti]];
          if (tab.ltype != 1)
            continue;
          Typr.U._applyType1(gls, ci, tab);
        }
      }
    }
    var cligs = ["rlig", "liga", "mset"];
    for (var ci = 0; ci < gls.length; ci++) {
      var gl = gls[ci];
      var rlim = Math.min(3, gls.length - ci - 1);
      for (var fi = 0; fi < flist.length; fi++) {
        var fl = flist[fi];
        if (cligs.indexOf(fl.tag) == -1)
          continue;
        for (var ti = 0; ti < fl.tab.length; ti++) {
          var tab = llist[fl.tab[ti]];
          for (var j = 0; j < tab.tabs.length; j++) {
            if (tab.tabs[j] == null)
              continue;
            var ind = Typr._lctf.coverageIndex(tab.tabs[j].coverage, gl);
            if (ind == -1)
              continue;
            if (tab.ltype == 4) {
              var vals = tab.tabs[j].vals[ind];
              for (var k = 0; k < vals.length; k++) {
                var lig = vals[k], rl = lig.chain.length;
                if (rl > rlim)
                  continue;
                var good = true;
                for (var l = 0; l < rl; l++)
                  if (lig.chain[l] != gls[ci + (1 + l)])
                    good = false;
                if (!good)
                  continue;
                gls[ci] = lig.nglyph;
                for (var l = 0; l < rl; l++)
                  gls[ci + l + 1] = -1;
              }
            } else if (tab.ltype == 5) {
              var ltab = tab.tabs[j];
              if (ltab.fmt != 2)
                continue;
              var cind = Typr._lctf.getInterval(ltab.cDef, gl);
              var cls = ltab.cDef[cind + 2], scs = ltab.scset[cls];
              for (var i = 0; i < scs.length; i++) {
                var sc = scs[i], inp = sc.input;
                if (inp.length > rlim)
                  continue;
                var good = true;
                for (var l = 0; l < inp.length; l++) {
                  var cind2 = Typr._lctf.getInterval(ltab.cDef, gls[ci + 1 + l]);
                  if (cind == -1 && ltab.cDef[cind2 + 2] != inp[l]) {
                    good = false;
                    break;
                  }
                }
                if (!good)
                  continue;
                var lrs = sc.substLookupRecords;
                for (var k = 0; k < lrs.length; k += 2) {
                  lrs[k];
                  lrs[k + 1];
                }
              }
            }
          }
        }
      }
    }
    return gls;
  };
  Typr.U._applyType1 = function(gls, ci, tab) {
    var gl = gls[ci];
    for (var j = 0; j < tab.tabs.length; j++) {
      var ttab = tab.tabs[j];
      var ind = Typr._lctf.coverageIndex(ttab.coverage, gl);
      if (ind == -1)
        continue;
      if (ttab.fmt == 1)
        gls[ci] = gls[ci] + ttab.delta;
      else
        gls[ci] = ttab.newg[ind];
    }
  };
  Typr.U.glyphsToPath = function(font, gls, clr) {
    var tpath = { cmds: [], crds: [] };
    var x = 0;
    for (var i = 0; i < gls.length; i++) {
      var gid = gls[i];
      if (gid == -1)
        continue;
      var gid2 = i < gls.length - 1 && gls[i + 1] != -1 ? gls[i + 1] : 0;
      var path = Typr.U.glyphToPath(font, gid);
      for (var j = 0; j < path.crds.length; j += 2) {
        tpath.crds.push(path.crds[j] + x);
        tpath.crds.push(path.crds[j + 1]);
      }
      if (clr)
        tpath.cmds.push(clr);
      for (var j = 0; j < path.cmds.length; j++)
        tpath.cmds.push(path.cmds[j]);
      if (clr)
        tpath.cmds.push("X");
      x += font.hmtx.aWidth[gid];
      if (i < gls.length - 1)
        x += Typr.U.getPairAdjustment(font, gid, gid2);
    }
    return tpath;
  };
  Typr.U.pathToSVG = function(path, prec) {
    if (prec == null)
      prec = 5;
    var out = [], co = 0, lmap = { M: 2, L: 2, Q: 4, C: 6 };
    for (var i = 0; i < path.cmds.length; i++) {
      var cmd = path.cmds[i], cn = co + (lmap[cmd] ? lmap[cmd] : 0);
      out.push(cmd);
      while (co < cn) {
        var c = path.crds[co++];
        out.push(parseFloat(c.toFixed(prec)) + (co == cn ? "" : " "));
      }
    }
    return out.join("");
  };
  Typr.U.pathToContext = function(path, ctx) {
    var c = 0, crds = path.crds;
    for (var j = 0; j < path.cmds.length; j++) {
      var cmd = path.cmds[j];
      if (cmd == "M") {
        ctx.moveTo(crds[c], crds[c + 1]);
        c += 2;
      } else if (cmd == "L") {
        ctx.lineTo(crds[c], crds[c + 1]);
        c += 2;
      } else if (cmd == "C") {
        ctx.bezierCurveTo(crds[c], crds[c + 1], crds[c + 2], crds[c + 3], crds[c + 4], crds[c + 5]);
        c += 6;
      } else if (cmd == "Q") {
        ctx.quadraticCurveTo(crds[c], crds[c + 1], crds[c + 2], crds[c + 3]);
        c += 4;
      } else if (cmd.charAt(0) == "#") {
        ctx.beginPath();
        ctx.fillStyle = cmd;
      } else if (cmd == "Z") {
        ctx.closePath();
      } else if (cmd == "X") {
        ctx.fill();
      }
    }
  };
  Typr.U.P = {};
  Typr.U.P.moveTo = function(p, x, y) {
    p.cmds.push("M");
    p.crds.push(x, y);
  };
  Typr.U.P.lineTo = function(p, x, y) {
    p.cmds.push("L");
    p.crds.push(x, y);
  };
  Typr.U.P.curveTo = function(p, a, b, c, d, e, f) {
    p.cmds.push("C");
    p.crds.push(a, b, c, d, e, f);
  };
  Typr.U.P.qcurveTo = function(p, a, b, c, d) {
    p.cmds.push("Q");
    p.crds.push(a, b, c, d);
  };
  Typr.U.P.closePath = function(p) {
    p.cmds.push("Z");
  };
  Typr.U._drawCFF = function(cmds, state, font, p) {
    var stack = state.stack;
    var nStems = state.nStems, haveWidth = state.haveWidth, width = state.width, open = state.open;
    var i = 0;
    var x = state.x, y = state.y, c1x = 0, c1y = 0, c2x = 0, c2y = 0, c3x = 0, c3y = 0, c4x = 0, c4y = 0, jpx = 0, jpy = 0;
    var o = { val: 0, size: 0 };
    while (i < cmds.length) {
      Typr.CFF.getCharString(cmds, i, o);
      var v = o.val;
      i += o.size;
      if (v == "o1" || v == "o18") {
        var hasWidthArg;
        hasWidthArg = stack.length % 2 !== 0;
        if (hasWidthArg && !haveWidth) {
          width = stack.shift() + font.Private.nominalWidthX;
        }
        nStems += stack.length >> 1;
        stack.length = 0;
        haveWidth = true;
      } else if (v == "o3" || v == "o23") {
        var hasWidthArg;
        hasWidthArg = stack.length % 2 !== 0;
        if (hasWidthArg && !haveWidth) {
          width = stack.shift() + font.Private.nominalWidthX;
        }
        nStems += stack.length >> 1;
        stack.length = 0;
        haveWidth = true;
      } else if (v == "o4") {
        if (stack.length > 1 && !haveWidth) {
          width = stack.shift() + font.Private.nominalWidthX;
          haveWidth = true;
        }
        if (open)
          Typr.U.P.closePath(p);
        y += stack.pop();
        Typr.U.P.moveTo(p, x, y);
        open = true;
      } else if (v == "o5") {
        while (stack.length > 0) {
          x += stack.shift();
          y += stack.shift();
          Typr.U.P.lineTo(p, x, y);
        }
      } else if (v == "o6" || v == "o7") {
        var count = stack.length;
        var isX = v == "o6";
        for (var j = 0; j < count; j++) {
          var sval = stack.shift();
          if (isX)
            x += sval;
          else
            y += sval;
          isX = !isX;
          Typr.U.P.lineTo(p, x, y);
        }
      } else if (v == "o8" || v == "o24") {
        var count = stack.length;
        var index = 0;
        while (index + 6 <= count) {
          c1x = x + stack.shift();
          c1y = y + stack.shift();
          c2x = c1x + stack.shift();
          c2y = c1y + stack.shift();
          x = c2x + stack.shift();
          y = c2y + stack.shift();
          Typr.U.P.curveTo(p, c1x, c1y, c2x, c2y, x, y);
          index += 6;
        }
        if (v == "o24") {
          x += stack.shift();
          y += stack.shift();
          Typr.U.P.lineTo(p, x, y);
        }
      } else if (v == "o11")
        break;
      else if (v == "o1234" || v == "o1235" || v == "o1236" || v == "o1237") {
        if (v == "o1234") {
          c1x = x + stack.shift();
          c1y = y;
          c2x = c1x + stack.shift();
          c2y = c1y + stack.shift();
          jpx = c2x + stack.shift();
          jpy = c2y;
          c3x = jpx + stack.shift();
          c3y = c2y;
          c4x = c3x + stack.shift();
          c4y = y;
          x = c4x + stack.shift();
          Typr.U.P.curveTo(p, c1x, c1y, c2x, c2y, jpx, jpy);
          Typr.U.P.curveTo(p, c3x, c3y, c4x, c4y, x, y);
        }
        if (v == "o1235") {
          c1x = x + stack.shift();
          c1y = y + stack.shift();
          c2x = c1x + stack.shift();
          c2y = c1y + stack.shift();
          jpx = c2x + stack.shift();
          jpy = c2y + stack.shift();
          c3x = jpx + stack.shift();
          c3y = jpy + stack.shift();
          c4x = c3x + stack.shift();
          c4y = c3y + stack.shift();
          x = c4x + stack.shift();
          y = c4y + stack.shift();
          stack.shift();
          Typr.U.P.curveTo(p, c1x, c1y, c2x, c2y, jpx, jpy);
          Typr.U.P.curveTo(p, c3x, c3y, c4x, c4y, x, y);
        }
        if (v == "o1236") {
          c1x = x + stack.shift();
          c1y = y + stack.shift();
          c2x = c1x + stack.shift();
          c2y = c1y + stack.shift();
          jpx = c2x + stack.shift();
          jpy = c2y;
          c3x = jpx + stack.shift();
          c3y = c2y;
          c4x = c3x + stack.shift();
          c4y = c3y + stack.shift();
          x = c4x + stack.shift();
          Typr.U.P.curveTo(p, c1x, c1y, c2x, c2y, jpx, jpy);
          Typr.U.P.curveTo(p, c3x, c3y, c4x, c4y, x, y);
        }
        if (v == "o1237") {
          c1x = x + stack.shift();
          c1y = y + stack.shift();
          c2x = c1x + stack.shift();
          c2y = c1y + stack.shift();
          jpx = c2x + stack.shift();
          jpy = c2y + stack.shift();
          c3x = jpx + stack.shift();
          c3y = jpy + stack.shift();
          c4x = c3x + stack.shift();
          c4y = c3y + stack.shift();
          if (Math.abs(c4x - x) > Math.abs(c4y - y)) {
            x = c4x + stack.shift();
          } else {
            y = c4y + stack.shift();
          }
          Typr.U.P.curveTo(p, c1x, c1y, c2x, c2y, jpx, jpy);
          Typr.U.P.curveTo(p, c3x, c3y, c4x, c4y, x, y);
        }
      } else if (v == "o14") {
        if (stack.length > 0 && !haveWidth) {
          width = stack.shift() + font.nominalWidthX;
          haveWidth = true;
        }
        if (stack.length == 4) {
          var adx = stack.shift();
          var ady = stack.shift();
          var bchar = stack.shift();
          var achar = stack.shift();
          var bind = Typr.CFF.glyphBySE(font, bchar);
          var aind = Typr.CFF.glyphBySE(font, achar);
          Typr.U._drawCFF(font.CharStrings[bind], state, font, p);
          state.x = adx;
          state.y = ady;
          Typr.U._drawCFF(font.CharStrings[aind], state, font, p);
        }
        if (open) {
          Typr.U.P.closePath(p);
          open = false;
        }
      } else if (v == "o19" || v == "o20") {
        var hasWidthArg;
        hasWidthArg = stack.length % 2 !== 0;
        if (hasWidthArg && !haveWidth) {
          width = stack.shift() + font.Private.nominalWidthX;
        }
        nStems += stack.length >> 1;
        stack.length = 0;
        haveWidth = true;
        i += nStems + 7 >> 3;
      } else if (v == "o21") {
        if (stack.length > 2 && !haveWidth) {
          width = stack.shift() + font.Private.nominalWidthX;
          haveWidth = true;
        }
        y += stack.pop();
        x += stack.pop();
        if (open)
          Typr.U.P.closePath(p);
        Typr.U.P.moveTo(p, x, y);
        open = true;
      } else if (v == "o22") {
        if (stack.length > 1 && !haveWidth) {
          width = stack.shift() + font.Private.nominalWidthX;
          haveWidth = true;
        }
        x += stack.pop();
        if (open)
          Typr.U.P.closePath(p);
        Typr.U.P.moveTo(p, x, y);
        open = true;
      } else if (v == "o25") {
        while (stack.length > 6) {
          x += stack.shift();
          y += stack.shift();
          Typr.U.P.lineTo(p, x, y);
        }
        c1x = x + stack.shift();
        c1y = y + stack.shift();
        c2x = c1x + stack.shift();
        c2y = c1y + stack.shift();
        x = c2x + stack.shift();
        y = c2y + stack.shift();
        Typr.U.P.curveTo(p, c1x, c1y, c2x, c2y, x, y);
      } else if (v == "o26") {
        if (stack.length % 2) {
          x += stack.shift();
        }
        while (stack.length > 0) {
          c1x = x;
          c1y = y + stack.shift();
          c2x = c1x + stack.shift();
          c2y = c1y + stack.shift();
          x = c2x;
          y = c2y + stack.shift();
          Typr.U.P.curveTo(p, c1x, c1y, c2x, c2y, x, y);
        }
      } else if (v == "o27") {
        if (stack.length % 2) {
          y += stack.shift();
        }
        while (stack.length > 0) {
          c1x = x + stack.shift();
          c1y = y;
          c2x = c1x + stack.shift();
          c2y = c1y + stack.shift();
          x = c2x + stack.shift();
          y = c2y;
          Typr.U.P.curveTo(p, c1x, c1y, c2x, c2y, x, y);
        }
      } else if (v == "o10" || v == "o29") {
        var obj = v == "o10" ? font.Private : font;
        if (stack.length == 0) {
          console.log("error: empty stack");
        } else {
          var ind = stack.pop();
          var subr = obj.Subrs[ind + obj.Bias];
          state.x = x;
          state.y = y;
          state.nStems = nStems;
          state.haveWidth = haveWidth;
          state.width = width;
          state.open = open;
          Typr.U._drawCFF(subr, state, font, p);
          x = state.x;
          y = state.y;
          nStems = state.nStems;
          haveWidth = state.haveWidth;
          width = state.width;
          open = state.open;
        }
      } else if (v == "o30" || v == "o31") {
        var count, count1 = stack.length;
        var index = 0;
        var alternate = v == "o31";
        count = count1 & ~2;
        index += count1 - count;
        while (index < count) {
          if (alternate) {
            c1x = x + stack.shift();
            c1y = y;
            c2x = c1x + stack.shift();
            c2y = c1y + stack.shift();
            y = c2y + stack.shift();
            if (count - index == 5) {
              x = c2x + stack.shift();
              index++;
            } else
              x = c2x;
            alternate = false;
          } else {
            c1x = x;
            c1y = y + stack.shift();
            c2x = c1x + stack.shift();
            c2y = c1y + stack.shift();
            x = c2x + stack.shift();
            if (count - index == 5) {
              y = c2y + stack.shift();
              index++;
            } else
              y = c2y;
            alternate = true;
          }
          Typr.U.P.curveTo(p, c1x, c1y, c2x, c2y, x, y);
          index += 4;
        }
      } else if ((v + "").charAt(0) == "o") {
        console.log("Unknown operation: " + v, cmds);
        throw v;
      } else
        stack.push(v);
    }
    state.x = x;
    state.y = y;
    state.nStems = nStems;
    state.haveWidth = haveWidth;
    state.width = width;
    state.open = open;
  };
  var typr_js = Typr;
  const Typr$1 = /* @__PURE__ */ getDefaultExportFromCjs(typr_js);
  function request(url, method, data = void 0, headers = void 0, timeout = 5e3) {
    if (method === "GET" && data) {
      url += `?${new URLSearchParams(data).toString()}`;
    }
    const finalHeaders = {
      "User-Agent": _unsafeWindow.navigator.userAgent,
      "Content-Type": "application/json",
      ...headers
    };
    return new Promise((resolve, reject) => {
      const startTime = Date.now();
      _GM_xmlhttpRequest({
        method,
        url,
        headers: finalHeaders,
        data: method !== "GET" ? JSON.stringify(data) : void 0,
        timeout,
        onload: function(response) {
          const endTime = Date.now();
          const duration = endTime - startTime;
          resolve([response, duration]);
        },
        ontimeout: () => reject(new Error("接口请求超时")),
        onerror: (error) => {
          console.error("接口请求失败", error);
          reject(error);
        }
      });
    });
  }
  function requestFetch(url, method, data, headers, timeout = 5e3) {
    const finalHeaders = {
      "User-Agent": _unsafeWindow.navigator.userAgent,
      "Content-Type": "application/json",
      ...headers
    };
    return new Promise((resolve, reject) => {
      fetch(url, {
        method,
        headers: finalHeaders,
        body: JSON.stringify(data)
      }).then((response) => response.json()).then(resolve).catch(function(error) {
        reject(error);
      });
    });
  }
  function headi() {
    let z = Array.from({ length: 4 }, () => Math.floor(Math.random() * 255)).join(".");
    return {
      "X-Forwarded-For": z,
      "X-Real-IP": z
    };
  }
  function removeHtml(htmlStr) {
    const textArea = document.createElement("textarea");
    textArea.innerHTML = htmlStr;
    htmlStr = textArea.value;
    htmlStr = htmlStr.replace(/[\t\r\xa0]/g, " ");
    htmlStr = htmlStr.replace(/[\u2000-\u200a]/g, " ");
    htmlStr = htmlStr.replace(/<br\s*\/?>/g, "\n");
    htmlStr = htmlStr.replace(/<(\/)?(p|div).*?>/g, "\n");
    htmlStr = htmlStr.replace(/ {2,}/g, " ");
    htmlStr = htmlStr.replace(/\n{2,}/g, "\n");
    htmlStr = purify.sanitize(htmlStr, { ALLOWED_TAGS: ["img", "br", "sub", "sup", "table", "caption", "thead", "tfoot", "tbody", "tr", "th", "td", "strong"], ALLOWED_ATTR: ["src", "href"], ALLOW_DATA_ATTR: false });
    return htmlStr.trim();
  }
  function titleClean(title) {
    return title.replace(/^【.*?】\s*/, "").replace(/\s*(\d+\.\d+分)$/, "");
  }
  function typeChange(typeNumber) {
    console.log(typeNumber);
    let types = {
      "单选题": "0",
      "多选题": "1",
      "填空题": "2",
      "判断题": "3",
      "简答题": "4",
      "名词解释": "5",
      "论述题": "6",
      "计算题": "7"
    };
    return types[typeNumber] ?? "8";
  }
  function typeChange2(typeNumber) {
    let types = {
      "0": "单选题",
      "1": "多选题",
      "2": "填空题",
      "3": "判断题",
      "4": "简答题",
      "5": "名词解释",
      "6": "论述题",
      "7": "计算题"
    };
    return types[typeNumber] ?? "其他";
  }
  function answerFormat(answer) {
    if (answer instanceof Array) {
      answer = answer.filter(function(item) {
        return item !== null;
      });
      for (let i = 0; i < answer.length; i++) {
        answer[i] = removeHtml(answer[i]);
      }
    } else if (typeof answer === "string") {
      answer = titleClean(answer);
    }
    return answer;
  }
  function removeSpace(str) {
    return str.replace(/[\s\p{P}]/gu, "");
  }
  function matchAnswer(answer, options) {
    console.log(options, answer);
    if (answer == "" || answer == null || answer == void 0) {
      return [];
    }
    answer = answerFormat(answer);
    let isMatch = options.every((item) => {
      return removeSpace(item).match(/^[\d\u4e00-\u9fa5]+$/);
    });
    if (isMatch) {
      answer = answer.map((item) => removeSpace(item));
      options = options.map((item) => removeSpace(item));
    }
    var matchArr = [];
    for (var i = 0; i < answer.length; i++) {
      for (var j = 0; j < options.length; j++) {
        if (answer[i] == options[j]) {
          matchArr.push(j);
        }
      }
    }
    return matchArr;
  }
  const decode = () => {
    var _a;
    const styleElements = _unsafeWindow.document.querySelectorAll("style");
    let tipElement = null;
    styleElements.forEach((styleElement) => {
      var _a2;
      if (((_a2 = styleElement.textContent) == null ? void 0 : _a2.indexOf("font-cxsecret")) !== -1) {
        tipElement = styleElement;
      }
    });
    if (!tipElement)
      return;
    const fontMatch = (_a = tipElement.textContent) == null ? void 0 : _a.match(/base64,([\w\W]+?)'/);
    if (!fontMatch)
      return;
    const fontData = base64ToUint8Array(fontMatch[1]);
    const font = Typr$1.parse(fontData);
    const table = JSON.parse(_GM_getResourceText("ttf"));
    let text2 = {};
    for (let i = 19968; i < 40870; i++) {
      let t = Typr$1.U.codeToGlyph(font, i);
      if (!t)
        continue;
      t = Typr$1.U.glyphToPath(font, t);
      t = md5(JSON.stringify(t)).slice(24);
      text2[i] = table[t];
    }
    const fontElements = _unsafeWindow.document.querySelectorAll(".font-cxsecret");
    fontElements.forEach((fontElement) => {
      let html2 = fontElement.innerHTML;
      Object.keys(text2).forEach((key) => {
        const regex = new RegExp(String.fromCharCode(key), "g");
        html2 = html2.replace(regex, String.fromCharCode(text2[key]));
      });
      fontElement.innerHTML = html2;
      fontElement.classList.remove("font-cxsecret");
    });
  };
  const base64ToUint8Array = (base64) => {
    const decodedData = atob(base64);
    const array = new Uint8Array(decodedData.length);
    for (let i = 0; i < decodedData.length; i++) {
      array[i] = decodedData.charCodeAt(i);
    }
    return array;
  };
  function recoverConsole() {
    var iframe = document.createElement("iframe");
    iframe.style.display = "none";
    document.body.appendChild(iframe);
    window.console = iframe.contentWindow.console;
  }
  function qc(item) {
    $(item).find(".answerBg, .textDIV, .eidtDiv").each(function() {
      ($(this).find(".check_answer").length || $(this).find(".check_answer_dx").length) && $(this).click();
    });
    $(item).find(".answerBg, .textDIV, .eidtDiv").find("textarea").each(function() {
      _unsafeWindow.UE.getEditor($(this).attr("name")).ready(function() {
        this.setContent("");
      });
    });
    $(item).find(":radio, :checkbox").prop("checked", false);
    $(item).find("textarea").each(function() {
      _unsafeWindow.UE.getEditor($(this).attr("name")).ready(function() {
        this.setContent("");
      });
    });
  }
  function qc1(item) {
    $(item).find(".before-after, .textDIV, .eidtDiv").each(function() {
      ($(this).find(".check_answer").length || $(this).find(".check_answer_dx").length) && $(this).click();
    });
    $(item).find(".before-after, .textDIV, .eidtDiv").find("textarea").each(function() {
      _unsafeWindow.UE.getEditor($(this).attr("name")).ready(function() {
        this.setContent("");
      });
    });
    $(item).find(":radio, :checkbox").prop("checked", false);
    $(item).find("textarea").each(function() {
      _unsafeWindow.UE.getEditor($(this).attr("name")).ready(function() {
        this.setContent("");
      });
    });
  }
  class Answer {
    constructor() {
    }
    /**
     * @description: 接口打分,是否有答案,是否匹配
     */
    static score(answer) {
    }
    /**
     * @description: 批量获取答案
     */
    static async getAnswers(questionList) {
      const promises = [
        this.getAnswer3(questionList)
      ];
      return Promise.all(promises);
    }
    /**
     * @description: 批量获取答案(免费接口)
     */
    static async getAnswersFree(questionList) {
      const promises = [
        this.getAnswer1(questionList)
        // this.getAnswer2(questionList),
      ];
      return Promise.all(promises);
    }
    /**
     * @description: 内置接口1 一之题库
     */
    static async getAnswer1(questionData2) {
      let headers = headi();
      return new Promise((resolve) => {
        request("http://cx.icodef.com/wyn-nb?v=4", "POST", {
          question: questionData2.question
        }, headers).then((res) => {
          let duration = res[1];
          try {
            res = JSON.parse(res[0].responseText);
          } catch (error) {
            resolve({ form: "免费题库", answer: null, error, duration });
          }
          let answer = "";
          if (res.code === 1) {
            let data = res.data.replace(/javascript:void\(0\);/g, "").trim().replace(/\n/g, "");
            const keywords = ["叛逆", "公众号", "李恒雅", "一之"];
            if (keywords.every((keyword) => !data.includes(keyword))) {
              answer = data.split("#");
            }
          }
          resolve({ form: "免费题库", answer, duration });
        }).catch((error) => {
          resolve({ form: "免费题库", answer: void 0, error });
        });
      });
    }
    static async getAnswer2(questionData2) {
      return new Promise((resolve) => {
        if (![0, 1, 2].includes(parseInt(questionData2.type))) {
          resolve({
            form: "muketool",
            answer: "",
            duration: "不支持的题型"
          });
          return;
        }
        request("https://api.muketool.com/cx/v2/query", "POST", {
          question: questionData2.question,
          type: parseInt(questionData2.type)
        }, {}).then((res) => {
          let duration = res[1];
          res = JSON.parse(res[0].responseText);
          resolve({
            form: "muketool",
            answer: res.code === 1 ? res.data.split("#") : "",
            duration
          });
        }).catch(() => {
          resolve({
            form: "muketool",
            answer: ""
          });
        });
      });
    }
    static async getAnswer3(questionData2) {
      const headers = {
        "Content-Type": "application/json",
        "referer": location.href,
        "v": "123"
      };
      const data = {
        question: questionData2.question,
        // 选项数组
        options: questionData2.options.map((item) => item),
        type: questionData2.type,
        questionData: questionData2.questionData.innerHTML,
        workType: questionData2.workType,
        key: ""
      };
      return new Promise((resolve) => {
        request("http://62.234.36.191/search", "POST", data, headers).then((res) => {
          let duration = res[1];
          res = JSON.parse(res[0].responseText);
          if (res.code === 200) {
            resolve({
              form: "tiku",
              answer: res.data.answer,
              duration,
              msg: res.msg
            });
          } else {
            resolve({
              form: "tiku",
              answer: "",
              duration,
              msg: res.msg
            });
          }
        }).catch((error) => {
          resolve({
            form: "tiku",
            answer: "",
            error,
            duration: 10,
            msg: "请求失败"
          });
        });
      });
    }
  }
  const appConfig = {
    debug: true,
    api: [
      {
        url: "http://127.0.0.1:9966/",
        header: {}
      },
      {
        url: "http://82.157.105.20:9966/",
        header: {}
      }
    ],
    // 第三方接口
    searchApi: [],
    // 默认显示悬浮窗
    showFloat: true,
    // 右下角看板
    showBoard: true,
    // 检测更新
    checkUpdate: true,
    // 默认开启自动答题
    autoAnswer: false,
    // 答题是否跳过已完成
    skipAnswered: true
  };
  const appCache = Cache.get("app") || appConfig;
  const ConfigInput = {
    "base": [
      {
        "type": "switch",
        "label": "显示悬浮窗",
        "name": "showFloat",
        "value": appCache.showFloat,
        "desc": "打开页面时是否显示悬浮窗",
        "options": []
      },
      {
        "type": "switch",
        "label": "看板小图标",
        "name": "showBoard",
        "value": appCache.showBoard,
        "desc": "打开页面时是否显示右下角看板",
        "options": []
      },
      {
        "type": "switch",
        "label": "检测更新",
        "name": "checkUpdate",
        "value": appCache.checkUpdate,
        "desc": "打开页面时是否检测更新",
        "options": []
      }
    ],
    "ask": [
      {
        "type": "switch",
        "label": "自动答题",
        "name": "autoAnswer",
        "value": appCache.autoAnswer,
        "desc": "打开页面时是否自动答题",
        "options": []
      },
      {
        "type": "switch",
        "label": "跳过已答题",
        "name": "skipAnswered",
        "value": appCache.skipAnswered,
        "desc": "答题时是否跳过已答题",
        "options": []
      }
    ]
  };
  const useAppStore = defineStore("app", {
    state: () => ({
      app: appCache,
      script: _GM_info.script,
      page: "home",
      ConfigInput
    }),
    actions: {
      setConfig(config) {
        this.app = config;
        Cache.set("app", config);
      },
      // 修改页面
      setPage(page) {
        this.page = page;
      }
    }
  });
  class Work {
    constructor() {
      __publicField(this, "ask");
      __publicField(this, "app");
      /**
       * @description: 初始化
       */
      __publicField(this, "init", async () => {
        var _a;
        switch (true) {
          case /\/work\/doHomeWorkNew/i.test(location.pathname):
            decode();
            recoverConsole();
            this.app.app.showFloat = true;
            this.app.setPage("ask");
            this.ask.clearQuestion();
            $(".TiMu").each((index, element) => {
              let temp = Cx.parseQuestion(element, 1);
              this.ask.addQuestion(temp);
            });
            this.ask.toggleStart();
            break;
          case /\/mooc2\/work\/dowork/i.test(location.pathname):
            this.app.app.showFloat = true;
            this.app.setPage("ask");
            this.ask.clearQuestion();
            $(".questionLi").each((index, element) => {
              let temp = Cx.parseQuestion(element, 2);
              this.ask.addQuestion(temp);
            });
            this.ask.toggleStart();
            break;
          case /\/test\/reVersionTestStartNew/i.test(location.pathname):
          case /\/mooc2\/exam\/preview/i.test(location.pathname):
            recoverConsole();
            this.app.app.showFloat = true;
            this.ask.clearQuestion();
            this.app.setPage("ask");
            $(".questionLi").each((index, element) => {
              let temp = Cx.parseQuestion(element, 3);
              this.ask.addQuestion(temp);
            });
            break;
          case /\/exam\/test\/examcode\/examnotes/i.test(location.pathname):
            $(".agree_check").click();
            $("#startBtn").removeClass("opa40");
            break;
          case /\/work\/selectWorkQuestionYiPiYue/i.test(location.pathname):
            if (!location.href.includes("mooc2=1")) {
              break;
            }
            Cx.s();
          default:
            (_a = document.getElementById("AiAskApp")) == null ? void 0 : _a.remove();
            break;
        }
      });
      this.app = useAppStore();
      this.ask = useAskStore();
      this.ask.start = this.app.autoAnswer;
    }
  }
  /**
   * @description: 填写答案
   */
  __publicField(Work, "ApiAnswerMatch", (res, ques) => {
    var _a;
    let type = ques.type, html2 = ques.questionData;
    let matchArr = [];
    switch (type) {
      case "0":
      case "1":
        for (let i2 = 0; i2 < res.length; i2++) {
          let answer2 = res[i2].answer;
          let matchArr2 = matchAnswer(answer2, ques.options);
          res[i2].match = matchArr2;
        }
        matchArr = res.filter((item) => item.match.length > 0);
        if (matchArr.length === 0) {
          return {
            res,
            haveAnswer: false
          };
        }
        if (matchArr.length > 1) {
          let isSame = matchArr.every((item) => item.match.length === matchArr[0].match.length);
          if (!isSame) {
            let max = matchArr[0];
            for (let i2 = 1; i2 < matchArr.length; i2++) {
              if (matchArr[i2].match.length > max.match.length) {
                max = matchArr[i2];
              }
            }
            matchArr = [max];
          }
        }
        let selectM = matchArr[0].match;
        qc(html2);
        qc1(html2);
        for (var i = 0; i < selectM.length; i++) {
          $(html2).find("ul:eq(0) li :radio,:checkbox,textarea").eq(selectM[i]).click();
          $(html2).find(".answerBg").eq(selectM[i]).click();
          $(html2).find("li").eq(selectM[i]).click();
        }
        break;
      case "3":
        matchArr = res.map((item) => {
          let answer2 = item.answer;
          if (typeof answer2 === "object") {
            answer2 = answer2[0];
          }
          if (answer2.match(/(^|,)(True|true|正确|是|对|√|T|ri)(,|$)/)) {
            item.answer = "正确";
          } else if (answer2.match(/(^|,)(False|false|错误|否|错|×|F|wr)(,|$)/)) {
            item.answer = "错误";
          } else {
            item.answer = "";
          }
          return item;
        });
        matchArr = res.filter((item) => item.answer !== "");
        if (matchArr.length === 0) {
          return {
            res,
            haveAnswer: false
          };
        }
        let bold = matchArr[0].answer;
        qc(html2);
        qc1(html2);
        switch (ques.workType) {
          case "zj":
            $(html2).find("li.before-after").each(function() {
              if ($(this).find(".num_option").attr("data") == "true" && bold == "正确") {
                $(this).click();
              }
              if ($(this).find(".num_option").attr("data") == "false" && bold == "错误") {
                $(this).click();
              }
            });
            break;
          case "zy":
          case "ks":
            $(html2).find(".answerBg").each(function(index) {
              if ($(this).find(".num_option").attr("data") == "true" && bold == "正确") {
                $(this).click();
              }
              if ($(this).find(".num_option").attr("data") == "false" && bold == "错误") {
                $(this).click();
              }
            });
            break;
        }
        break;
      case "2":
      case "9":
      case "4":
      case "5":
      case "6":
      case "7":
        const blankNum = $(html2).find("textarea").length;
        matchArr = res.filter((item) => item.answer.length > 0);
        matchArr = matchArr.filter((item) => (typeof item.answer === "string" ? 1 : item.answer.length) === blankNum);
        if (matchArr.length === 0) {
          return {
            res,
            haveAnswer: false
          };
        }
        let answer = matchArr[0].answer;
        if (typeof answer === "string") {
          answer = [answer];
        }
        qc(html2);
        qc1(html2);
        $(html2).find("textarea").each(function(index) {
          _unsafeWindow.UE.getEditor($(this).attr("name")).ready(function() {
            this.setContent(answer[index].replace(/第.空:/g, ""));
          });
        });
        (_a = $(html2).find(".savebtndiv>a")) == null ? void 0 : _a.click();
        break;
    }
    return {
      res,
      // 采用答案
      form: matchArr ? matchArr[0] : [],
      haveAnswer: true
    };
  });
  class Cx {
    static async s() {
      const questionList = $(".TiMu").map(function(inde, element) {
        try {
          let questionHtml, questionText, questionType, questionAnswer, questionOption = [], questionAnalysis = "";
          questionHtml = $(element).find(".Zy_TItle .clearfix");
          questionText = removeHtml(questionHtml[0].innerHTML);
          questionType = questionText.match(/^\【(.+?)\】/)[1];
          questionText = questionText.replace(
            questionText.match(/^\【(.+?)\】/)[0],
            ""
          );
          switch (questionType) {
            case "判断题":
              let correctAnswerBx = removeHtml($(element).find(".correctAnswer .answerCon").html());
              console.log(correctAnswerBx);
              let myAnswer = removeHtml($(element).find(".myAnswer .answerCon").html());
              console.log(myAnswer);
              break;
            case "填空题":
              break;
            default:
              return null;
          }
          return {
            question: questionText,
            options: questionOption,
            type: typeChange(questionType),
            answer: questionAnswer,
            analysis: questionAnalysis
          };
        } catch {
          return null;
        }
      }).get();
      console.log(questionList);
    }
  }
  __publicField(Cx, "parseQuestion", (html2, type = 1) => {
    let questionHtml, questionText, questionTypeId, optionHtml, workType, optionText, index;
    switch (type) {
      case 1:
        workType = "zj";
        questionHtml = $(html2).find(".clearfix .fontLabel");
        questionText = removeHtml(questionHtml[0].innerHTML);
        questionTypeId = $(html2).find("input[name^=answertype]:eq(0)").val();
        optionHtml = $(html2).find("ul:eq(0) li .after");
        optionText = [];
        optionHtml.each(function(_inx, item) {
          optionText.push(removeHtml(item.innerHTML));
        });
        break;
      case 2:
        workType = "zy";
        questionHtml = $(html2).find(".mark_name");
        index = questionHtml[0].innerHTML.indexOf("</span>");
        questionText = removeHtml(questionHtml[0].innerHTML.substring(index + 7));
        questionHtml[0].getElementsByTagName("span")[0].innerHTML.replace("(", "").replace(")", "").split(",")[0];
        questionTypeId = $(html2).find("input[name^=answertype]:eq(0)").val();
        optionHtml = $(html2).find(".answer_p");
        optionText = [];
        for (let i = 0; i < optionHtml.length; i++) {
          optionText.push(removeHtml(optionHtml[i].innerHTML));
        }
        break;
      case 3:
        workType = "ks";
        $(".mask_div").remove();
        questionHtml = $(html2).find(".mark_name.colorDeep");
        index = questionHtml.html().indexOf("</span>");
        questionText = removeHtml(questionHtml.html().substring(index + 7));
        questionHtml.find("span").html().replace("(", "").replace(")", "").split(",")[0];
        questionTypeId = $(html2).find("input[name^=type]:eq(0)").val();
        optionHtml = $(html2).find(".answer_p");
        optionText = [];
        for (let i = 0; i < optionHtml.length; i++) {
          optionText.push(removeHtml(optionHtml[i].innerHTML));
        }
        break;
    }
    return {
      "question": titleClean(questionText ?? ""),
      "options": optionText,
      "type": questionTypeId,
      "questionData": html2,
      "workType": workType
    };
  });
  const useAskStore = defineStore("ask", {
    state: () => ({
      questionList: [],
      questionInx: 0,
      // 当前索引
      inx: 0,
      Interval: 0,
      // 开启答题
      start: false,
      skipFinish: false,
      // 运行锁
      lock: false,
      // 统计题库
      formMap: {}
    }),
    actions: {
      addQuestion(questionData2) {
        this.questionList.push({
          ...questionData2,
          answer: [],
          status: 0
        });
      },
      // 清空问题列表
      clearQuestion() {
        this.questionList = [];
      },
      getQuestion() {
        return this.questionList[this.questionInx];
      },
      nextQuestion() {
        if (this.questionInx === this.questionList.length - 1) {
          clearInterval(this.Interval);
          this.start = false;
          return;
        }
        this.questionInx++;
      },
      prevQuestion() {
        if (this.questionInx === 0) {
          return;
        }
        this.questionInx--;
      },
      // 切换到指定问题
      toQuestion(inx) {
        this.questionInx = inx;
        let ques = this.questionList[inx];
        ques.questionData.scrollIntoView({ block: "center" });
        if (_unsafeWindow.self !== _unsafeWindow.top) {
          let el = document.querySelector(".el-dialog");
          if (el) {
            el.style.transform = "none";
            let rect = ques.questionData.getBoundingClientRect();
            document.documentElement.scrollHeight;
            el.style.top = `${rect.top - 700}px`;
            if (inx === 0) {
              el.style.top = "0px";
            }
            if (inx === this.questionList.length - 1) {
              if (document.documentElement.scrollHeight > 2e3) {
                el.style.top = `${rect.top - 900}px`;
              }
            }
          }
        }
        ques.questionData.style.boxShadow = "0 0 10px rgba(0, 0, 0, 0.15)";
        setTimeout(() => {
          ques.questionData.style.boxShadow = "";
        }, 500);
      },
      // 修改题目状态
      setQuestionStatus(inx, status) {
        this.questionList[inx].status = status;
      },
      // 切换答题状态
      async toggleStart() {
        if (this.lock)
          return;
        this.start = !this.start;
        if (!this.start)
          return;
        this.lock = true;
        for (let i = this.questionInx; i < this.questionList.length && this.start; i++) {
          this.questionInx = i;
          let ques = this.questionList[i];
          let res = await Answer.getAnswersFree(ques);
          let m = Work.ApiAnswerMatch(res, ques);
          ques.answer = m.res;
          ques.form = m.form;
          if (!m.haveAnswer) {
            this.setQuestionStatus(i, 2);
          } else {
            this.setQuestionStatus(i, 1);
          }
        }
        this.start = false;
        this.lock = false;
        this.formMap = {};
        this.questionList.forEach((item) => {
          var _a;
          if ((_a = item.form) == null ? void 0 : _a.form) {
            let key = item.form.form;
            if (key) {
              this.formMap[key] = this.formMap[key] ? this.formMap[key] + 1 : 1;
            }
          } else {
            this.formMap["无答案"] = this.formMap["无答案"] ? this.formMap["无答案"] + 1 : 1;
          }
        });
      },
      pause() {
        this.start = false;
      },
      restart() {
        this.questionInx = 0;
        this.start = true;
        this.toggleStart();
      }
    },
    getters: {
      // 当前问题
      current() {
        return this.questionList[this.questionInx];
      }
    }
  });
  const ApiCache = Cache.get("apiList", []);
  const DefApi = {
    name: "",
    url: "",
    method: "GET",
    params: [],
    response: [],
    request: [],
    headers: []
  };
  const DefParam = {
    name: "",
    value: "",
    type: "sys"
  };
  const testQuestionData = {
    "question": "急性吗啡中毒的拮抗剂是:",
    "options": ["纳酪酮", "曲马朵", "尼莫地平", "阿托品", "肾上腺素"],
    "type": "0",
    "questionData": "",
    "workType": "ks"
  };
  const useApiStore = defineStore("api", {
    state: () => ({
      apiList: ApiCache,
      // 当前编辑的接口
      currentApi: DefApi,
      currentParam: DefParam
    }),
    actions: {
      // 删除接口
      deleteApi(index) {
        this.apiList.splice(index, 1);
        Cache.set("apiList", this.apiList);
      },
      // 添加接口
      addApi() {
        this.apiList.push(this.currentApi);
        console.log(this.currentParam);
        Cache.set("apiList", this.apiList);
      },
      // 更新接口
      updateApi(index, api) {
        this.apiList[index] = api;
        Cache.set("apiList", this.apiList);
      },
      // 添加参数
      addParam() {
        this.currentApi.params.push({
          name: this.currentParam.name,
          value: this.currentParam.value,
          type: this.currentParam.type
        });
        this.currentParam = DefParam;
      },
      // 删除参数
      deleteParam(index) {
        this.currentApi.params.splice(index, 1);
      },
      // 恢复默认
      reset() {
        this.currentApi = DefApi;
        this.currentParam = DefParam;
      },
      // 编辑接口
      editApi(index) {
        this.currentApi = this.apiList[index];
      },
      // 编辑参数
      editParam(index) {
        this.currentParam = this.currentApi.params[index];
      },
      // 测试API
      testApi(index) {
        let api = this.apiList[index];
        console.log(api);
        let data = {};
        api.params.forEach((item) => {
          console.log(item.value);
          switch (item.value) {
            case "$question":
              data[item.name] = testQuestionData.question;
              console.log(testQuestionData.question);
              break;
            case "$options":
              data[item.name] = testQuestionData.options;
              break;
            case "$typeid":
              data[item.name] = testQuestionData.type;
              break;
            case "$questionData":
              data[item.name] = testQuestionData.questionData;
              break;
            case "$workType":
              data[item.name] = testQuestionData.workType;
              break;
            case "$timestamp":
              data[item.name] = (/* @__PURE__ */ new Date()).getTime();
              break;
            case "$random":
              data[item.name] = Math.random();
              break;
            default:
              data[item.name] = item.value;
          }
        });
        console.log(api.url, api.method, data);
        return requestFetch(api.url, api.method, data, {});
      }
    },
    getters: {}
  });
  const mini = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1702363595473'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='9984'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M253.360825%201024l-115.279176-58.836014v-53.205773c-64.888522-68.266667-62.917938-94.728797%2014.075602-153.424055-23.506254-17.594502-63.762474%202.674364-77.275052-36.315051%2047.434777-42.930584%2070.378007-101.062818%2087.972509-162.010172a326.694708%20326.694708%200%200%201%20208.037388-226.617182c4.644948-89.380069%2086.84646-143.430378%20178.478626-112.604811l-35.611272%2090.36536c105.144742%207.319313%20192.413471%2045.041924%20256.316701%20123.302268%2040.537732%2015.483162%2038.84866-34.766735%2069.251959-40.819244l11.964261%2058.27299%2050.390653-27.306667c28.151203%2018.72055-5.207973%2031.951615-10.415945%2052.220482%2014.779381%2020.12811%2028.995739%2040.537732%2044.4789%2060.243573a142.867354%20142.867354%200%200%201%2028.995739%20114.153128c-12.527285%2077.838076-30.262543%20154.831615-41.100756%20233.091958a1276.938557%201276.938557%200%200%200-5.207972%20139.48921h-21.113402l-89.239313-70.378007%209.993677-10.415945-17.735258%2036.878076L731.931271%20959.956014l-39.411683%2023.787766-42.226804-21.113402c-28.151203%2014.075601-52.501993%2036.03354-86.564949%2027.306667l-9.008385-37.863368H332.747216l-26.602886%2071.926323z%20m-9.993677-380.041237l-0.844536%200.985292%20126.680412%2019.705842%2010.838213%2010.978969c-29.277251%2032.373883-19.846598%2074.178419-29.699519%20110.493471L384.404674%20816.38488l-35.189004%2094.869553a412.274364%20412.274364%200%200%200%20233.514227%202.11134l9.712165-26.602886%2012.808797%2015.905429-11.823505%2050.672165%205.348728%204.644949c16.749966-11.682749%2033.218419-24.210034%2050.812921-34.62598a84.453608%2084.453608%200%200%201%2026.039863-5.348728l7.460069%2033.922199L731.931271%20928.145155l52.924262%2014.075601c-1.829828-43.212096-2.955876-80.934708-5.911753-118.516564%200-4.92646-9.852921-9.289897-15.060893-14.075601l-5.630241-23.224742%2014.075601-100.922062h18.72055l3.237389-1.266804c-11.964261%20106.411546%208.023093%20202.266392%2087.127972%20281.512027%208.726873-48.842337%2016.60921-93.321237%2024.632302-137.659381%207.460069-40.96%2015.060893-81.92%2022.520963-122.88%2010.556701-48.420069%2025.476838-97.262405-10.978969-140.756014L886.762887%20602.435739c0-16.468454%201.126048-33.077663%201.126048-49.546117%200-70.378007-53.205773-104.722474-115.982956-76.289759a232.951203%20232.951203%200%200%201-32.936907%209.430652c16.046186-32.373883-3.5189-52.924261-25.476838-70.378006a292.209485%20292.209485%200%200%200-209.304193-70.378007c-11.401237%200.70378-22.802474%200-40.25622%200l45.182681-104.581718c-40.396976%2010.978969-74.037663%2014.779381-94.728798%2045.464192s14.920137%2045.88646%2020.831891%2069.674227C325.005636%20360.194639%20232.528935%20436.343643%20198.606735%20548.948454l-70.378006%20172.707628%2049.123848%203.518901%205.630241%2054.191065c32.514639-26.039863%2026.039863-61.08811%2030.262543-92.898969h17.876014v58.413746l30.966323%206.33402c1.40756-6.615533%202.392852-11.682749%203.659656-16.468453%209.149141-34.625979-19.705842-59.117526-22.380206-91.491409zM205.50378%20822.859656l-6.474777%2020.83189-25.336082%2084.453609c1.548316%208.867629%200%2023.224742%205.067216%2025.476838%2032.373883%2016.046186%2065.733058%2029.277251%20104.159451%2045.745705%2021.113402-65.451546%2063.621718-114.434639%2069.53347-180.871478C315.152715%20802.309278%20281.512027%20786.966873%20247.730584%20774.158076c-17.031478-6.756289-36.315052-10.978969-35.048247%2019.002061z%20m121.753952-38.848659l10.556701-90.224605-48.138557-6.193265v78.964124z%20m-168.907217%2096.980893l23.083987-73.474639c-28.151203-10.415945-47.575533-9.289897-56.302406%2015.483161s2.674364%2042.789828%2032.936907%2057.991478z'%20fill='%23353947'%20p-id='9985'%3e%3c/path%3e%3cpath%20d='M198.606735%20548.948454c33.922199-112.604811%20126.680412-188.472302%20235.907079-192.272715-5.911753-23.787766-41.100756-39.55244-20.83189-69.674227s54.331821-34.485223%2094.728798-45.464192l-45.182681%20104.581718h40.25622a292.209485%20292.209485%200%200%201%20209.304193%2070.378007c21.957938%2017.735258%2042.226804%2038.285636%2025.476838%2070.378007l0.985292-0.985293c-30.966323%2026.743643-32.796151%2059.399038-19.846598%2095.151066l25.195327%2040.96-40.819244-6.193265-103.174158-14.075601-62.214158-93.039725-31.670104%2050.672165c-19.42433-5.630241-26.602887%200.844536-20.691134%2020.691134L464.494845%20579.210997a165.669828%20165.669828%200%200%200-100.077525-17.172234l-10.415945-86.564949L316.560275%20506.721649l-44.338144%2042.226805z%20m255.190653-62.917939l-10.556701-10.556701c-17.172234-17.031478-35.048247-15.060893-47.29402%203.378145s-4.785704%2036.73732%2012.105017%2050.249897c20.12811%2016.046186%2034.907491%209.712165%2045.745704-11.541993%2014.216357-10.838213%2015.201649-21.394914%200-31.81086z'%20fill='%23F5F5F6'%20p-id='9986'%20data-spm-anchor-id='a313x.search_index.0.i5.dc0f3a810XA6r8'%20class='selected'%3e%3c/path%3e%3cpath%20d='M592.442062%20886.762887l-9.712165%2026.602886a412.274364%20412.274364%200%200%201-233.514227-2.11134l35.189004-94.869553-34.062956-30.544055c9.852921-36.315052%200-78.119588%2029.699519-110.493471a198.184467%20198.184467%200%200%200%20105.426254-94.869553c16.327698%202.392852%2026.039863-1.689072%2020.691134-20.691134l31.670104-4.926461L600.887423%20633.402062c0%207.882337-1.970584%2018.01677%201.970584%2023.083986%2030.966323%2038.707904%2023.787766%2080.934708%2014.075601%20123.865292-8.586117%2036.03354-16.468454%2071.363299-24.491546%20106.411547zM442.818419%20663.523849c0%2014.075601-2.81512%2023.64701%200%2026.884398%2020.268866%2020.691134%2020.83189%2045.604948%2019.565086%2071.926323a96.840137%2096.840137%200%200%200%203.237388%2031.107079c5.911753%2020.409622%2012.668041%2041.382268%2038.426392%2044.056633A48.560825%2048.560825%200%200%200%20557.393814%20802.309278a696.601512%20696.601512%200%200%200%2018.579794-80.371683c6.052509-6.474777%2035.470515-2.533608%2018.157526-36.596564z'%20fill='%23F5F5F6'%20p-id='9987'%3e%3c/path%3e%3cpath%20d='M600.605911%20602.013471l103.174158%2014.075601%2040.819244%205.348729c37.863368%209.993677%2022.94323%2041.241512%2026.46213%2065.170034l-14.075601%20100.922062-49.827629%2078.119588-21.394914%2031.529347-10.134433%2021.394914a84.453608%2084.453608%200%200%200-26.039863%205.348728c-17.594502%2010.415945-34.062955%2022.94323-50.812921%2034.62598v-5.207973h-5.067216l11.823505-50.672165c16.046186-61.932646%2032.936907-123.724536%2047.716289-185.938694%205.348729-22.661718-25.476838-68.266667-51.938969-82.62378zM927.300619%20706.735945c-7.460069%2040.96-15.060893%2081.92-22.520963%20122.88-8.023093%2044.338144-15.90543%2088.817045-24.632302%20137.659381-79.10488-79.386392-98.52921-175.241237-87.127973-281.512027z'%20fill='%23B3DCF8'%20p-id='9988'%3e%3c/path%3e%3cpath%20d='M199.029003%20843.691546l6.474777-20.83189h45.604949c2.11134-39.270928-20.972646-30.262543-38.426392-30.121787-1.548316-29.981031%2018.01677-25.758351%2035.048247-18.579793%2034.062955%2013.231065%2067.422131%2028.151203%20104.722474%2044.4789-5.911753%2066.436838-48.420069%20115.419931-69.53347%20180.871478-38.426392-16.186942-71.926323-29.418007-104.159451-45.182681-4.785704-2.252096-3.5189-16.60921-5.067216-25.476838h33.499931l26.321375-70.378007z'%20fill='%2387BC85'%20p-id='9989'%3e%3c/path%3e%3cpath%20d='M738.265292%20486.030515a232.951203%20232.951203%200%200%200%2032.936907-9.430652c62.777182-28.151203%20116.405223%206.615533%20115.982956%2076.289759%200%2016.468454-0.70378%2033.077663-1.126048%2049.546117l1.126048-0.985292-12.105018-2.674365-21.53567%2016.749966-29.981031%208.304605A86.564948%2086.564948%200%200%201%20731.931271%20564.572371c2.392852-26.462131%204.644948-52.924261%207.037801-79.527148z%20m113.730859%2061.79189l-61.369622-52.501993c-3.941168%2035.752027-6.615533%2059.821306-10.275189%2093.180481z'%20fill='%23F5F5F6'%20p-id='9990'%20data-spm-anchor-id='a313x.search_index.0.i3.dc0f3a810XA6r8'%20class=''%3e%3c/path%3e%3cpath%20d='M198.606735%20548.948454h73.615396c-28.151203%2042.226804-74.178419%2076.852784-59.117526%20137.659381-4.22268%2031.810859%202.252096%2066.859107-30.262543%2092.898969l-6.052509-54.472577-49.123849-3.518901z'%20fill='%23AED4EF'%20p-id='9991'%3e%3c/path%3e%3cpath%20d='M927.300619%20706.735945l-134.281238-21.113402-3.237388%201.266804%206.897045-37.863368%2027.025154-7.74158%2031.247835-8.867629%2029.840275-20.691134%202.392853-10.275189-0.422268%200.985292%2030.262543-36.73732c35.752027%2043.77512%2020.83189%2092.617457%2010.275189%20141.037526zM369.625292%20663.946117l-126.680412-19.705842a171.300069%20171.300069%200%200%201%2016.749965-41.100756c21.817182-29.277251%2046.167973-56.302405%2069.533471-84.453608%203.237388%209.149141%206.756289%2018.157526%209.571409%2027.306666q15.623918%2049.123849%2030.966323%2098.52921z'%20fill='%23F5F5F6'%20p-id='9992'%3e%3c/path%3e%3cpath%20d='M763.179107%20810.473127c5.207973%204.644948%2014.075601%209.008385%2015.060893%2014.075602%202.955876%2037.581856%204.081924%2075.304467%205.911753%20118.516563l-52.924262-14.075601-47.9978%2023.787766-7.600825-34.766735c14.075601-1.970584%2020.550378-7.882337%2010.978969-21.817182%2021.394914%2011.682749%2023.787766-9.993677%2033.359175-19.002062z'%20fill='%23AED4EF'%20p-id='9993'%3e%3c/path%3e%3cpath%20d='M601.168935%20634.105842c26.462131%2014.075601%2057.287698%2059.962062%2051.938969%2082.62378-14.075601%2062.214158-31.670103%20124.006048-47.716289%20185.938694L592.442062%20886.762887c8.023093-35.329759%2015.90543-70.378007%2024.35079-105.989279%2010.134433-42.930584%2017.31299-85.157388-14.075601-123.865292-3.5189-4.785704-0.985292-14.920137-1.548316-22.802474zM328.806048%20518.404399c-23.365498%2028.151203-47.716289%2055.457869-69.533471%2084.453608a171.300069%20171.300069%200%200%200-16.749965%2041.100756l0.844536-0.985292-12.386529%2043.07134h-17.876014C198.043711%20625.660481%20243.507904%20591.175258%20272.222131%20548.948454l44.338144-42.226805z'%20fill='%23484F5E'%20p-id='9994'%3e%3c/path%3e%3cpath%20d='M327.257732%20784.010997l-37.581856-17.453746v-78.964124l48.138557%206.193265z'%20fill='%23D55375'%20p-id='9995'%3e%3c/path%3e%3cpath%20d='M823.704192%20641.284399l-27.025154%207.74158-6.897045%2037.863368h-18.72055c-3.5189-23.928522%2011.401237-55.176357-26.46213-65.170034l-25.195327-40.96%2012.527285-16.186942a86.564948%2086.564948%200%200%200%2091.350653%2059.258282zM369.625292%20663.946117v-19.846598l12.245773-12.949553c8.445361%201.266804%2020.409622%206.897045%2024.773059%203.237388%2020.550378-17.031478%2038.989416-36.455808%2058.132233-55.176357l20.972646%201.548316A198.184467%20198.184467%200%200%201%20380.041237%20675.628866z'%20fill='%23484F5E'%20p-id='9996'%3e%3c/path%3e%3cpath%20d='M199.029003%20843.691546l34.485224%2014.075602-26.321375%2070.378007h-33.499931z'%20fill='%23CAE7AF'%20p-id='9997'%3e%3c/path%3e%3cpath%20d='M230.980619%20686.326323l12.386529-43.07134c2.674364%2031.670103%2031.529347%2056.302405%2022.23945%2091.350653-1.266804%204.785704-2.252096%209.852921-3.659656%2016.468453l-30.966323-6.33402z'%20fill='%23F5F5F6'%20p-id='9998'%3e%3c/path%3e%3cpath%20d='M763.179107%20810.473127l-44.056633%2067.703643-11.964261-12.527285%2050.390653-78.4011z'%20fill='%23484F5E'%20p-id='9999'%3e%3c/path%3e%3cpath%20d='M212.682337%20792.737869c17.453746%200%2040.537732-9.149141%2038.426392%2030.121787H205.50378z'%20fill='%23CDEAB1'%20p-id='10000'%3e%3c/path%3e%3cpath%20d='M598.916838%20957.98543l-5.348728-4.644949h5.067216z'%20fill='%23484F5E'%20p-id='10001'%3e%3c/path%3e%3cpath%20d='M464.494845%20579.210997c-19.142818%2018.72055-37.581856%2038.14488-58.132233%2055.176357-4.363436%203.659656-16.327698-1.970584-24.773059-3.237388l-17.172233-69.111203A165.669828%20165.669828%200%200%201%20464.494845%20579.210997z'%20fill='%23AED4EF'%20p-id='10002'%3e%3c/path%3e%3cpath%20d='M364.41732%20562.038763l17.172233%2069.111203-12.245773%2012.949553q-15.342405-49.123849-30.966323-98.52921c-2.81512-9.149141-6.334021-18.157526-9.571409-27.306666l-12.245773-11.541994%2037.4411-30.966323z'%20fill='%23353947'%20p-id='10003'%3e%3c/path%3e%3cpath%20d='M600.605911%20602.013471v31.670103l-62.214158-79.245636-31.670104%204.926461%2031.388592-50.390653z'%20fill='%23484F5E'%20p-id='10004'%3e%3c/path%3e%3cpath%20d='M453.797388%20517.278351c-10.838213%2021.254158-25.617595%2028.151203-45.745704%2011.541993-16.890722-14.075601-24.632302-31.529347-12.105017-50.249897s30.121787-20.409622%2047.29402-3.378145c-23.506254%200.985292-34.766735%2011.541993-29.136495%2039.411684l39.693196%203.096633z'%20fill='%23AED4EF'%20p-id='10005'%3e%3c/path%3e%3cpath%20d='M731.931271%20564.572371l-12.808797%2015.623918c-12.949553-35.752027-11.119725-68.407423%2019.846598-95.151066-2.11134%2026.602887-4.363436%2053.065017-7.037801%2079.527148z'%20fill='%23353947'%20p-id='10006'%3e%3c/path%3e%3cpath%20d='M506.721649%20559.786667c5.348729%2019.002062-4.363436%2023.083986-20.691134%2020.691134-6.193265-19.846598%200.985292-26.321375%2020.691134-20.691134z'%20fill='%23484F5E'%20p-id='10007'%3e%3c/path%3e%3cpath%20d='M453.797388%20485.749003c15.201649%2010.415945%2014.075601%2020.972646%200%2031.529348v-31.81086zM443.240687%20475.192302l10.556701%2010.556701-10.556701-10.556701z'%20fill='%23AED4EF'%20p-id='10008'%3e%3c/path%3e%3cpath%20d='M442.818419%20663.523849l151.312715%2022.098694c17.31299%2034.062955-12.105017%2030.121787-18.157526%2036.596564A696.601512%20696.601512%200%200%201%20557.393814%20802.309278a48.560825%2048.560825%200%200%201-52.783505%2034.907492c-25.758351-2.674364-32.514639-23.64701-38.426391-44.056633a96.840137%2096.840137%200%200%201-3.237389-31.107079c1.266804-26.321375%200-51.235189-19.565086-71.926323-3.378144-2.955876-0.563024-12.386529-0.563024-26.602886z%20m66.296083%20153.987079c41.523024-26.462131%2042.226804-60.38433%2034.766735-98.52921l-55.317113-10.275189c-0.422268%2038.707904-15.201649%2075.163711%2020.550378%20108.804399zM707.158213%20865.649485l11.964261%2012.527285c-9.571409%209.008385-11.964261%2030.684811-33.359175%2019.002062z'%20fill='%23353947'%20p-id='10009'%3e%3c/path%3e%3cpath%20d='M686.185567%20896.756564c9.571409%2014.075601%202.955876%2019.846598-10.978969%2021.817182zM851.996151%20547.822405l-71.644811%2040.678488c3.659656-33.359175%206.334021-57.428454%2010.275189-93.180481z'%20fill='%23353947'%20p-id='10010'%3e%3c/path%3e%3cpath%20d='M884.792302%20611.725636l-29.840275%2020.691134-1.40756-16.890722%2021.53567-16.749966z'%20fill='%23484F5E'%20p-id='10011'%20data-spm-anchor-id='a313x.search_index.0.i4.dc0f3a810XA6r8'%20class='selected'%3e%3c/path%3e%3cpath%20d='M853.544467%20615.526048l1.40756%2016.890722-31.247835%208.867629v-17.453746zM884.792302%20611.725636l-9.712165-12.949554%2012.105018%202.674365z'%20fill='%23353947'%20p-id='10012'%3e%3c/path%3e%3cpath%20d='M443.522199%20474.91079l10.556701%2010.556701v31.951616l-39.693196-3.096633c-6.193265-27.869691%205.630241-38.426392%2029.136495-39.411684z'%20fill='%23F5F5F6'%20p-id='10013'%3e%3c/path%3e%3cpath%20d='M509.114502%20817.510928c-35.752027-33.640687-20.972646-70.378007-20.550378-108.804399l55.317113%2010.275189c7.882337%2038.14488%206.756289%2072.067079-34.766735%2098.52921z'%20fill='%23E25679'%20p-id='10014'%3e%3c/path%3e%3c/svg%3e";
  const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
    __name: "Home",
    setup(__props) {
      const appStore = useAppStore();
      return (_ctx, _cache) => {
        const _component_el_button = vue.resolveComponent("el-button");
        return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
          vue.createVNode(_component_el_button, {
            type: "primary",
            plain: "",
            onClick: _cache[0] || (_cache[0] = ($event) => console.log(vue.unref(appStore).app))
          }, {
            default: vue.withCtx(() => [
              vue.createTextVNode("输出配置")
            ]),
            _: 1
          }),
          vue.createVNode(_component_el_button, {
            type: "primary",
            plain: "",
            onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(appStore).setPage("note"))
          }, {
            default: vue.withCtx(() => [
              vue.createTextVNode("切换公告")
            ]),
            _: 1
          }),
          vue.createVNode(_component_el_button, {
            type: "primary",
            plain: "",
            onClick: _cache[2] || (_cache[2] = ($event) => vue.unref(appStore).setPage("Base"))
          }, {
            default: vue.withCtx(() => [
              vue.createTextVNode("切换基础配置")
            ]),
            _: 1
          }),
          vue.createVNode(_component_el_button, {
            type: "primary",
            plain: "",
            onClick: _cache[3] || (_cache[3] = ($event) => vue.unref(appStore).setPage("ask"))
          }, {
            default: vue.withCtx(() => [
              vue.createTextVNode("切换答题页")
            ]),
            _: 1
          }),
          vue.createVNode(_component_el_button, {
            type: "primary",
            plain: "",
            onClick: _cache[4] || (_cache[4] = ($event) => vue.unref(appStore).setPage("api"))
          }, {
            default: vue.withCtx(() => [
              vue.createTextVNode("切换题库配置")
            ]),
            _: 1
          })
        ], 64);
      };
    }
  });
  const _export_sfc = (sfc, props) => {
    const target = sfc.__vccOpts || sfc;
    for (const [key, val] of props) {
      target[key] = val;
    }
    return target;
  };
  const Home = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-e40e424a"]]);
  const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
    __name: "Note",
    setup(__props) {
      vue.ref("1");
      return (_ctx, _cache) => {
        return vue.openBlock(), vue.createElementBlock("h1", null, "这是一个公告");
      };
    }
  });
  const _hoisted_1$2 = { style: { "margin": "10px" } };
  const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
    __name: "Base",
    setup(__props) {
      const appStore = useAppStore();
      vue.watch(appStore.app, (newVal) => {
        appStore.setConfig(newVal);
      });
      vue.watch(appStore.ConfigInput, (newVal) => {
        for (let key in newVal) {
          for (let key1 in newVal[key]) {
            let item = newVal[key][key1];
            appStore.app[item.name] = item.value;
            console.log(item.name, item.value);
          }
        }
      });
      const ConfigInput2 = appStore.ConfigInput;
      return (_ctx, _cache) => {
        const _component_el_alert = vue.resolveComponent("el-alert");
        const _component_el_col = vue.resolveComponent("el-col");
        const _component_el_switch = vue.resolveComponent("el-switch");
        const _component_el_input = vue.resolveComponent("el-input");
        const _component_el_input_number = vue.resolveComponent("el-input-number");
        const _component_el_option = vue.resolveComponent("el-option");
        const _component_el_select = vue.resolveComponent("el-select");
        const _component_el_checkbox = vue.resolveComponent("el-checkbox");
        const _component_el_checkbox_group = vue.resolveComponent("el-checkbox-group");
        const _component_el_tooltip = vue.resolveComponent("el-tooltip");
        const _component_el_row = vue.resolveComponent("el-row");
        return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
          vue.createVNode(_component_el_alert, {
            title: "配置修改后会自动保存,直接刷新页面即可",
            type: "info",
            closable: false,
            "show-icon": ""
          }),
          (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(ConfigInput2).base, (item1) => {
            return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
              vue.createVNode(_component_el_row, {
                class: "row-bg",
                justify: "space-between",
                align: "middle"
              }, {
                default: vue.withCtx(() => [
                  vue.createVNode(_component_el_col, { span: 6 }, {
                    default: vue.withCtx(() => [
                      vue.createTextVNode(vue.toDisplayString(item1.label), 1)
                    ]),
                    _: 2
                  }, 1024),
                  vue.createVNode(_component_el_col, {
                    span: 18,
                    style: { "text-align": "right" }
                  }, {
                    default: vue.withCtx(() => [
                      vue.createVNode(_component_el_tooltip, {
                        class: "grid-content ep-bg-purple-light",
                        effect: "dark",
                        content: item1.desc || "",
                        placement: "top"
                      }, {
                        default: vue.withCtx(() => [
                          item1.type === "switch" ? (vue.openBlock(), vue.createBlock(_component_el_switch, {
                            key: 0,
                            modelValue: item1.value,
                            "onUpdate:modelValue": ($event) => item1.value = $event
                          }, null, 8, ["modelValue", "onUpdate:modelValue"])) : item1.type === "input" ? (vue.openBlock(), vue.createBlock(_component_el_input, {
                            key: 1,
                            modelValue: item1.value,
                            "onUpdate:modelValue": ($event) => item1.value = $event
                          }, null, 8, ["modelValue", "onUpdate:modelValue"])) : item1.type === "number" ? (vue.openBlock(), vue.createBlock(_component_el_input_number, {
                            key: 2,
                            modelValue: item1.value,
                            "onUpdate:modelValue": ($event) => item1.value = $event
                          }, null, 8, ["modelValue", "onUpdate:modelValue"])) : item1.type === "select" ? (vue.openBlock(), vue.createBlock(_component_el_select, {
                            key: 3,
                            modelValue: item1.value,
                            "onUpdate:modelValue": ($event) => item1.value = $event,
                            placeholder: "请选择"
                          }, {
                            default: vue.withCtx(() => [
                              (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(item1.options, (item2) => {
                                return vue.openBlock(), vue.createBlock(_component_el_option, {
                                  key: item2.value,
                                  label: item2.label,
                                  value: item2.value
                                }, null, 8, ["label", "value"]);
                              }), 128))
                            ]),
                            _: 2
                          }, 1032, ["modelValue", "onUpdate:modelValue"])) : item1.type === "checkbox" ? (vue.openBlock(), vue.createBlock(_component_el_checkbox_group, {
                            key: 4,
                            modelValue: item1.value,
                            "onUpdate:modelValue": ($event) => item1.value = $event
                          }, {
                            default: vue.withCtx(() => [
                              (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(item1.options, (item2) => {
                                return vue.openBlock(), vue.createBlock(_component_el_checkbox, {
                                  key: item2.value,
                                  label: item2.value,
                                  name: item2.value
                                }, {
                                  default: vue.withCtx(() => [
                                    vue.createTextVNode(vue.toDisplayString(item2.label), 1)
                                  ]),
                                  _: 2
                                }, 1032, ["label", "name"]);
                              }), 128))
                            ]),
                            _: 2
                          }, 1032, ["modelValue", "onUpdate:modelValue"])) : vue.createCommentVNode("", true)
                        ]),
                        _: 2
                      }, 1032, ["content"])
                    ]),
                    _: 2
                  }, 1024)
                ]),
                _: 2
              }, 1024)
            ]);
          }), 256))
        ], 64);
      };
    }
  });
  const _hoisted_1$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "aah_bomHet50" }, [
    /* @__PURE__ */ vue.createElementVNode("span", { class: "dq" }, [
      /* @__PURE__ */ vue.createElementVNode("i"),
      /* @__PURE__ */ vue.createTextVNode("当前题目")
    ]),
    /* @__PURE__ */ vue.createElementVNode("span", { class: "yp" }, [
      /* @__PURE__ */ vue.createElementVNode("i"),
      /* @__PURE__ */ vue.createTextVNode("已作答")
    ]),
    /* @__PURE__ */ vue.createElementVNode("span", { class: "wp" }, [
      /* @__PURE__ */ vue.createElementVNode("i"),
      /* @__PURE__ */ vue.createTextVNode("无答案")
    ]),
    /* @__PURE__ */ vue.createElementVNode("span", { class: "zp" }, [
      /* @__PURE__ */ vue.createElementVNode("i"),
      /* @__PURE__ */ vue.createTextVNode("未作答")
    ])
  ], -1);
  const _hoisted_2$1 = ["innerHTML"];
  const _hoisted_3$1 = ["innerHTML"];
  const _hoisted_4$1 = {
    key: 0,
    style: { "color": "green" }
  };
  const _hoisted_5$1 = { key: 0 };
  const _hoisted_6$1 = { key: 1 };
  const _hoisted_7 = ["innerHTML"];
  const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
    __name: "Ask",
    setup(__props) {
      const ask = useAskStore();
      const getOptionIndex = (inx) => {
        return String.fromCharCode(65 + inx);
      };
      return (_ctx, _cache) => {
        const _component_el_alert = vue.resolveComponent("el-alert");
        const _component_el_button = vue.resolveComponent("el-button");
        const _component_el_col = vue.resolveComponent("el-col");
        const _component_el_checkbox = vue.resolveComponent("el-checkbox");
        const _component_el_tag = vue.resolveComponent("el-tag");
        const _component_el_divider = vue.resolveComponent("el-divider");
        const _component_el_input = vue.resolveComponent("el-input");
        const _component_el_row = vue.resolveComponent("el-row");
        const _component_el_empty = vue.resolveComponent("el-empty");
        return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
          vue.createVNode(_component_el_alert, {
            style: { "margin-bottom": "10px" },
            title: "答题默认免费题库优先,请确保题库配置正确",
            type: "info",
            "show-icon": ""
          }),
          vue.unref(ask).current ? (vue.openBlock(), vue.createBlock(_component_el_row, { key: 0 }, {
            default: vue.withCtx(() => [
              vue.createVNode(_component_el_col, { span: 12 }, {
                default: vue.withCtx(() => [
                  vue.createVNode(_component_el_button, {
                    onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(ask).start ? vue.unref(ask).pause() : vue.unref(ask).toggleStart()),
                    size: "small",
                    class: "aah_btn",
                    type: "primary",
                    plain: ""
                  }, {
                    default: vue.withCtx(() => [
                      vue.createTextVNode(vue.toDisplayString(vue.unref(ask).start ? "暂停答题" : "开始答题"), 1)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }),
              vue.createVNode(_component_el_col, { span: 12 }, {
                default: vue.withCtx(() => [
                  vue.createVNode(_component_el_button, {
                    onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(ask).restart()),
                    size: "small",
                    class: "aah_btn",
                    type: "primary",
                    plain: ""
                  }, {
                    default: vue.withCtx(() => [
                      vue.createTextVNode("重新答题")
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }),
              vue.createVNode(_component_el_col, { span: 24 }, {
                default: vue.withCtx(() => [
                  _hoisted_1$1
                ]),
                _: 1
              }),
              (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(ask).questionList, (val, inx) => {
                return vue.openBlock(), vue.createBlock(_component_el_col, { span: 3 }, {
                  default: vue.withCtx(() => [
                    (vue.openBlock(), vue.createBlock(_component_el_button, {
                      class: vue.normalizeClass(inx == vue.unref(ask).questionInx ? "aah_active" : ""),
                      style: { "width": "30px", "margin-bottom": "4px" },
                      key: inx,
                      onClick: ($event) => vue.unref(ask).toQuestion(inx),
                      size: "small",
                      type: val.status == 1 ? "primary" : val.status == 2 ? "danger" : "",
                      plain: ""
                    }, {
                      default: vue.withCtx(() => [
                        vue.createTextVNode(vue.toDisplayString(inx + 1), 1)
                      ]),
                      _: 2
                    }, 1032, ["class", "onClick", "type"]))
                  ]),
                  _: 2
                }, 1024);
              }), 256)),
              vue.createVNode(_component_el_col, { span: 24 }, {
                default: vue.withCtx(() => [
                  vue.createVNode(_component_el_checkbox, {
                    modelValue: vue.unref(ask).skipFinish,
                    "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.unref(ask).skipFinish = $event),
                    label: "跳过已作答的题目(一次性)"
                  }, null, 8, ["modelValue"])
                ]),
                _: 1
              }),
              vue.unref(ask).formMap ? (vue.openBlock(), vue.createBlock(_component_el_col, {
                key: 0,
                span: 24
              }, {
                default: vue.withCtx(() => [
                  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(ask).formMap, (val, key) => {
                    return vue.openBlock(), vue.createBlock(_component_el_tag, {
                      key,
                      style: { "margin-right": "10px" }
                    }, {
                      default: vue.withCtx(() => [
                        vue.createTextVNode(vue.toDisplayString(key) + ":" + vue.toDisplayString(val) + " 次", 1)
                      ]),
                      _: 2
                    }, 1024);
                  }), 128))
                ]),
                _: 1
              })) : vue.createCommentVNode("", true),
              vue.createVNode(_component_el_divider, null, {
                default: vue.withCtx(() => [
                  vue.createTextVNode("当前题目")
                ]),
                _: 1
              }),
              vue.createVNode(_component_el_col, { span: 24 }, {
                default: vue.withCtx(() => [
                  vue.createElementVNode("div", {
                    class: "aah_title",
                    innerHTML: "[" + vue.unref(typeChange2)(vue.unref(ask).current.type ?? "") + "]" + vue.unref(ask).current.question
                  }, null, 8, _hoisted_2$1),
                  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(ask).current.options, (val, inx) => {
                    return vue.openBlock(), vue.createElementBlock("p", {
                      style: vue.normalizeStyle(vue.unref(ask).current.form && vue.unref(ask).current.form.match && vue.unref(ask).current.form.match.includes(inx) ? "color:green;" : ""),
                      class: "aah_options",
                      innerHTML: getOptionIndex(inx) + ". " + val
                    }, null, 12, _hoisted_3$1);
                  }), 256)),
                  vue.unref(ask).current.form ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_4$1, " 采用【" + vue.toDisplayString(vue.unref(ask).current.form.form) + "】的答案 ", 1)) : vue.createCommentVNode("", true)
                ]),
                _: 1
              }),
              vue.createVNode(_component_el_col, { span: 24 }, {
                default: vue.withCtx(() => [
                  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(ask).current.answer, (item) => {
                    return vue.openBlock(), vue.createElementBlock("div", null, [
                      vue.createVNode(_component_el_divider, null, {
                        default: vue.withCtx(() => [
                          vue.createTextVNode(vue.toDisplayString(`${item.form}(${item.duration}ms)`), 1)
                        ]),
                        _: 2
                      }, 1024),
                      typeof item.answer === "object" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$1, [
                        (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(item.answer, (ans) => {
                          return vue.openBlock(), vue.createElementBlock("p", null, [
                            vue.createVNode(_component_el_input, {
                              value: ans,
                              readonly: "",
                              style: { "width": "100%" }
                            }, null, 8, ["value"])
                          ]);
                        }), 256))
                      ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$1, [
                        vue.createElementVNode("div", {
                          innerHTML: item.answer ? item.answer : item.msg ?? "暂无答案"
                        }, null, 8, _hoisted_7)
                      ]))
                    ]);
                  }), 256))
                ]),
                _: 1
              })
            ]),
            _: 1
          })) : (vue.openBlock(), vue.createBlock(_component_el_empty, {
            key: 1,
            description: "暂无题目数据"
          }))
        ], 64);
      };
    }
  });
  const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
    __name: "Api",
    setup(__props) {
      const apiStore = useApiStore();
      console.log(apiStore.apiList);
      const deleteRow = (index) => {
        apiStore.deleteApi(index);
      };
      const paramVisible = vue.ref(false);
      const addParam = () => {
        if (apiStore.currentParam.name == "") {
          ElementPlus.ElNotification({
            title: "参数效验不通过",
            message: "参数名不能为空",
            type: "error"
          });
          return;
        }
        if (apiStore.currentParam.value == "") {
          ElementPlus.ElNotification({
            title: "参数效验不通过",
            message: "参数值不能为空",
            type: "error"
          });
          return;
        }
        const index = apiStore.currentApi.params.findIndex((item) => item.name == apiStore.currentParam.name);
        if (index != -1) {
          apiStore.currentApi.params[index] = apiStore.currentParam;
          ElementPlus.ElNotification({
            title: "更新成功",
            message: "参数已更新",
            type: "success"
          });
          paramVisible.value = false;
          return;
        }
        apiStore.addParam();
        paramVisible.value = false;
      };
      const addApi = () => {
        if (apiStore.currentApi.name == "") {
          ElementPlus.ElNotification({
            title: "参数效验不通过",
            message: "接口名不能为空",
            type: "error"
          });
          return;
        }
        if (apiStore.currentApi.url == "") {
          ElementPlus.ElNotification({
            title: "参数效验不通过",
            message: "接口地址不能为空",
            type: "error"
          });
          return;
        }
        if (apiStore.currentApi.params.length == 0) {
          ElementPlus.ElNotification({
            title: "参数效验不通过",
            message: "参数不能为空",
            type: "error"
          });
          return;
        }
        const index = apiStore.apiList.findIndex((item) => item.name == apiStore.currentApi.name);
        console.log(index);
        if (index != -1) {
          console.log(apiStore.apiList[index]);
          console.log(apiStore.currentApi);
          apiStore.updateApi(index, apiStore.currentApi);
          ElementPlus.ElNotification({
            title: "更新成功",
            message: "接口已更新",
            type: "success"
          });
        }
        apiStore.addApi();
        apiStore.reset();
      };
      const editApi = (index) => {
        apiStore.editApi(index);
      };
      const editParam = (index) => {
        apiStore.editParam(index);
        paramVisible.value = true;
      };
      const testApi = (index) => {
        apiStore.testApi(index).then((res) => {
          console.log(res);
        }).catch((err) => {
          console.log(err);
          ElementPlus.ElNotification({
            title: "请求失败",
            message: err,
            type: "error"
          });
        });
      };
      return (_ctx, _cache) => {
        const _component_el_alert = vue.resolveComponent("el-alert");
        const _component_el_input = vue.resolveComponent("el-input");
        const _component_el_form_item = vue.resolveComponent("el-form-item");
        const _component_el_option = vue.resolveComponent("el-option");
        const _component_el_select = vue.resolveComponent("el-select");
        const _component_el_button = vue.resolveComponent("el-button");
        const _component_el_form = vue.resolveComponent("el-form");
        const _component_el_dialog = vue.resolveComponent("el-dialog");
        const _component_el_table_column = vue.resolveComponent("el-table-column");
        const _component_el_table = vue.resolveComponent("el-table");
        const _component_el_col = vue.resolveComponent("el-col");
        const _component_el_row = vue.resolveComponent("el-row");
        return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
          vue.createVNode(_component_el_alert, {
            title: "当前功能开发中,若您有急需添加的API可以先反馈给作者",
            type: "error"
          }),
          vue.createVNode(_component_el_dialog, {
            modelValue: paramVisible.value,
            "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => paramVisible.value = $event),
            title: "添加参数",
            style: { "width": "400px" }
          }, {
            default: vue.withCtx(() => [
              vue.createVNode(_component_el_form, {
                model: vue.unref(apiStore).currentParam,
                "label-width": "auto"
              }, {
                default: vue.withCtx(() => [
                  vue.createVNode(_component_el_form_item, { label: "参数名" }, {
                    default: vue.withCtx(() => [
                      vue.createVNode(_component_el_input, {
                        modelValue: vue.unref(apiStore).currentParam.name,
                        "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(apiStore).currentParam.name = $event),
                        autocomplete: "off"
                      }, null, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  vue.createVNode(_component_el_form_item, { label: "参数类型" }, {
                    default: vue.withCtx(() => [
                      vue.createVNode(_component_el_select, {
                        modelValue: vue.unref(apiStore).currentParam.type,
                        "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.unref(apiStore).currentParam.type = $event),
                        placeholder: "请选择"
                      }, {
                        default: vue.withCtx(() => [
                          vue.createVNode(_component_el_option, {
                            label: "内置参数",
                            value: "sys"
                          }),
                          vue.createVNode(_component_el_option, {
                            label: "自定义参数",
                            value: "diy"
                          })
                        ]),
                        _: 1
                      }, 8, ["modelValue"])
                    ]),
                    _: 1
                  }),
                  vue.createVNode(_component_el_form_item, { label: "参数值" }, {
                    default: vue.withCtx(() => [
                      vue.unref(apiStore).currentParam.type == "diy" ? (vue.openBlock(), vue.createBlock(_component_el_input, {
                        key: 0,
                        modelValue: vue.unref(apiStore).currentParam.value,
                        "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.unref(apiStore).currentParam.value = $event),
                        autocomplete: "off"
                      }, null, 8, ["modelValue"])) : (vue.openBlock(), vue.createBlock(_component_el_select, {
                        key: 1,
                        modelValue: vue.unref(apiStore).currentParam.value,
                        "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vue.unref(apiStore).currentParam.value = $event),
                        placeholder: "请选择"
                      }, {
                        default: vue.withCtx(() => [
                          vue.createVNode(_component_el_option, {
                            label: "题型(字符串)",
                            value: "$type"
                          }),
                          vue.createVNode(_component_el_option, {
                            label: "题型(数字)",
                            value: "$typeid"
                          }),
                          vue.createVNode(_component_el_option, {
                            label: "题干(题目)",
                            value: "$question"
                          }),
                          vue.createVNode(_component_el_option, {
                            label: "选项",
                            value: "$options"
                          }),
                          vue.createVNode(_component_el_option, {
                            label: "时间戳",
                            value: "$timestamp"
                          }),
                          vue.createVNode(_component_el_option, {
                            label: "随机数",
                            value: "$random"
                          })
                        ]),
                        _: 1
                      }, 8, ["modelValue"]))
                    ]),
                    _: 1
                  }),
                  vue.createVNode(_component_el_form_item, null, {
                    default: vue.withCtx(() => [
                      vue.createVNode(_component_el_button, {
                        onClick: addParam,
                        plain: "",
                        style: { "width": "100%" }
                      }, {
                        default: vue.withCtx(() => [
                          vue.createTextVNode("添加")
                        ]),
                        _: 1
                      })
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }, 8, ["model"])
            ]),
            _: 1
          }, 8, ["modelValue"]),
          vue.createVNode(_component_el_table, {
            data: vue.unref(apiStore).apiList,
            style: { "width": "100%", "margin-bottom": "10px" },
            "empty-text": "暂无数据"
          }, {
            default: vue.withCtx(() => [
              vue.createVNode(_component_el_table_column, {
                prop: "name",
                label: "接口名",
                width: "120"
              }),
              vue.createVNode(_component_el_table_column, {
                prop: "url",
                label: "接口地址",
                width: "120"
              }),
              vue.createVNode(_component_el_table_column, {
                prop: "method",
                label: "请求方式",
                width: "120"
              }),
              vue.createVNode(_component_el_table_column, {
                fixed: "right",
                label: "操作",
                width: "120"
              }, {
                default: vue.withCtx((scope) => [
                  vue.createVNode(_component_el_button, {
                    link: "",
                    type: "primary",
                    size: "small",
                    onClick: vue.withModifiers(($event) => deleteRow(scope.$index), ["prevent"])
                  }, {
                    default: vue.withCtx(() => [
                      vue.createTextVNode(" 删除 ")
                    ]),
                    _: 2
                  }, 1032, ["onClick"]),
                  vue.createVNode(_component_el_button, {
                    link: "",
                    type: "primary",
                    size: "small",
                    onClick: vue.withModifiers(($event) => editApi(scope.$index), ["prevent"])
                  }, {
                    default: vue.withCtx(() => [
                      vue.createTextVNode(" 编辑 ")
                    ]),
                    _: 2
                  }, 1032, ["onClick"]),
                  vue.createVNode(_component_el_button, {
                    link: "",
                    type: "primary",
                    size: "small",
                    onClick: vue.withModifiers(($event) => testApi(scope.$index), ["prevent"])
                  }, {
                    default: vue.withCtx(() => [
                      vue.createTextVNode(" 测试 ")
                    ]),
                    _: 2
                  }, 1032, ["onClick"])
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["data"]),
          vue.createVNode(_component_el_row, null, {
            default: vue.withCtx(() => [
              vue.createVNode(_component_el_col, { span: 24 }, {
                default: vue.withCtx(() => [
                  vue.createVNode(_component_el_form, {
                    model: vue.unref(apiStore).currentApi,
                    "label-width": "80px"
                  }, {
                    default: vue.withCtx(() => [
                      vue.createVNode(_component_el_form_item, { label: "接口名" }, {
                        default: vue.withCtx(() => [
                          vue.createVNode(_component_el_input, {
                            modelValue: vue.unref(apiStore).currentApi.name,
                            "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue.unref(apiStore).currentApi.name = $event),
                            placeholder: "请输入接口名"
                          }, null, 8, ["modelValue"])
                        ]),
                        _: 1
                      }),
                      vue.createVNode(_component_el_form_item, { label: "接口地址" }, {
                        default: vue.withCtx(() => [
                          vue.createVNode(_component_el_input, {
                            modelValue: vue.unref(apiStore).currentApi.url,
                            "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => vue.unref(apiStore).currentApi.url = $event),
                            placeholder: "请输入接口地址"
                          }, null, 8, ["modelValue"])
                        ]),
                        _: 1
                      }),
                      vue.createVNode(_component_el_form_item, { label: "请求方式" }, {
                        default: vue.withCtx(() => [
                          vue.createVNode(_component_el_select, {
                            modelValue: vue.unref(apiStore).currentApi.method,
                            "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => vue.unref(apiStore).currentApi.method = $event),
                            placeholder: "请选择"
                          }, {
                            default: vue.withCtx(() => [
                              vue.createVNode(_component_el_option, {
                                label: "GET",
                                value: "GET"
                              }),
                              vue.createVNode(_component_el_option, {
                                label: "POST",
                                value: "POST"
                              })
                            ]),
                            _: 1
                          }, 8, ["modelValue"])
                        ]),
                        _: 1
                      }),
                      vue.createVNode(_component_el_form_item, { label: "请求参数" }, {
                        default: vue.withCtx(() => [
                          vue.createVNode(_component_el_table, {
                            data: vue.unref(apiStore).currentApi.params,
                            style: { "width": "100%" },
                            "empty-text": "暂无参数"
                          }, {
                            default: vue.withCtx(() => [
                              vue.createVNode(_component_el_table_column, {
                                prop: "name",
                                label: "参数名",
                                width: "120"
                              }),
                              vue.createVNode(_component_el_table_column, {
                                prop: "value",
                                label: "参数值",
                                width: "120"
                              }),
                              vue.createVNode(_component_el_table_column, {
                                fixed: "right",
                                label: "操作",
                                width: "120"
                              }, {
                                default: vue.withCtx((scope) => [
                                  vue.createVNode(_component_el_button, {
                                    link: "",
                                    type: "primary",
                                    size: "small",
                                    onClick: vue.withModifiers(($event) => vue.unref(apiStore).deleteParam(scope.$index), ["prevent"])
                                  }, {
                                    default: vue.withCtx(() => [
                                      vue.createTextVNode(" 删除 ")
                                    ]),
                                    _: 2
                                  }, 1032, ["onClick"]),
                                  vue.createVNode(_component_el_button, {
                                    link: "",
                                    type: "primary",
                                    size: "small",
                                    onClick: vue.withModifiers(($event) => editParam(scope.$index), ["prevent"])
                                  }, {
                                    default: vue.withCtx(() => [
                                      vue.createTextVNode(" 编辑 ")
                                    ]),
                                    _: 2
                                  }, 1032, ["onClick"])
                                ]),
                                _: 1
                              })
                            ]),
                            _: 1
                          }, 8, ["data"]),
                          vue.createVNode(_component_el_button, {
                            type: "primary",
                            onClick: _cache[8] || (_cache[8] = ($event) => paramVisible.value = true),
                            text: ""
                          }, {
                            default: vue.withCtx(() => [
                              vue.createTextVNode("添加参数")
                            ]),
                            _: 1
                          })
                        ]),
                        _: 1
                      }),
                      vue.createVNode(_component_el_form_item, null, {
                        default: vue.withCtx(() => [
                          vue.createVNode(_component_el_button, {
                            type: "primary",
                            onClick: addApi,
                            plain: ""
                          }, {
                            default: vue.withCtx(() => [
                              vue.createTextVNode("添加")
                            ]),
                            _: 1
                          })
                        ]),
                        _: 1
                      })
                    ]),
                    _: 1
                  }, 8, ["model"])
                ]),
                _: 1
              })
            ]),
            _: 1
          })
        ], 64);
      };
    }
  });
  const _hoisted_1 = { class: "wrapper" };
  const _hoisted_2 = ["src"];
  const _hoisted_3 = ["id"];
  const _hoisted_4 = {
    key: 0,
    class: "aah_breadcrumb"
  };
  const _hoisted_5 = /* @__PURE__ */ vue.createElementVNode("strong", null, "home", -1);
  const _hoisted_6 = ["src"];
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
    __name: "App",
    setup(__props) {
      const appStore = useAppStore();
      const work = new Work();
      work.init();
      document.onkeydown = function(e) {
        if (e.ctrlKey && e.key == "p") {
          appStore.app.showFloat = !appStore.app.showFloat;
        }
      };
      return (_ctx, _cache) => {
        const _component_el_button = vue.resolveComponent("el-button");
        const _component_el_breadcrumb_item = vue.resolveComponent("el-breadcrumb-item");
        const _component_el_breadcrumb = vue.resolveComponent("el-breadcrumb");
        const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
        const _component_el_dialog = vue.resolveComponent("el-dialog");
        return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
          vue.createVNode(_component_el_dialog, {
            modelValue: vue.unref(appStore).app.showFloat,
            "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.unref(appStore).app.showFloat = $event),
            title: "爱问答助手",
            draggable: "",
            overflow: "",
            "show-close": true,
            modal: false,
            "close-on-click-modal": false,
            style: { "width": "400px" }
          }, {
            header: vue.withCtx(({ close, titleId, titleClass }) => [
              vue.createElementVNode("img", {
                src: vue.unref(appStore).script.icon,
                alt: "icon",
                style: { "width": "20px", "height": "20px", "margin-right": "10px", "vertical-align": "middle" }
              }, null, 8, _hoisted_2),
              vue.createElementVNode("span", {
                id: titleId,
                class: vue.normalizeClass(titleClass)
              }, vue.toDisplayString(`${vue.unref(appStore).script.name} - ${vue.unref(appStore).script.version}`), 11, _hoisted_3),
              vue.createTextVNode("   "),
              vue.createVNode(_component_el_button, {
                type: "text",
                onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(appStore).app.showDebug = !vue.unref(appStore).app.showDebug)
              }, {
                default: vue.withCtx(() => [
                  vue.createTextVNode("log")
                ]),
                _: 1
              })
            ]),
            default: vue.withCtx(() => [
              vue.createVNode(_component_el_scrollbar, { "max-height": "55vh" }, {
                default: vue.withCtx(() => [
                  vue.unref(appStore).page != "home" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [
                    vue.createVNode(_component_el_breadcrumb, { separator: "/" }, {
                      default: vue.withCtx(() => [
                        vue.createVNode(_component_el_breadcrumb_item, {
                          onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(appStore).setPage("home"))
                        }, {
                          default: vue.withCtx(() => [
                            _hoisted_5
                          ]),
                          _: 1
                        }),
                        vue.createVNode(_component_el_breadcrumb_item, null, {
                          default: vue.withCtx(() => [
                            vue.createTextVNode(vue.toDisplayString(vue.unref(appStore).page), 1)
                          ]),
                          _: 1
                        })
                      ]),
                      _: 1
                    })
                  ])) : vue.createCommentVNode("", true),
                  vue.unref(appStore).page == "home" ? (vue.openBlock(), vue.createBlock(Home, { key: 1 })) : vue.unref(appStore).page == "note" ? (vue.openBlock(), vue.createBlock(_sfc_main$4, { key: 2 })) : vue.unref(appStore).page == "Base" ? (vue.openBlock(), vue.createBlock(_sfc_main$3, { key: 3 })) : vue.unref(appStore).page == "ask" ? (vue.openBlock(), vue.createBlock(_sfc_main$2, { key: 4 })) : vue.unref(appStore).page == "api" ? (vue.openBlock(), vue.createBlock(_sfc_main$1, { key: 5 })) : vue.createCommentVNode("", true)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["modelValue"]),
          vue.withDirectives(vue.createElementVNode("div", {
            class: "minimized-dialog",
            onClick: _cache[5] || (_cache[5] = ($event) => vue.unref(appStore).app.showFloat = true)
          }, [
            vue.createElementVNode("div", {
              onClick: _cache[4] || (_cache[4] = ($event) => vue.unref(appStore).app.showFloat = true)
            }, [
              vue.createElementVNode("img", {
                width: "104vh",
                src: vue.unref(mini),
                onClick: _cache[3] || (_cache[3] = ($event) => vue.unref(appStore).app.showFloat = true)
              }, null, 8, _hoisted_6)
            ])
          ], 512), [
            [vue.vShow, !vue.unref(appStore).app.showFloat]
          ])
        ]);
      };
    }
  });
  const cssLoader = (e) => {
    const t = GM_getResourceText(e);
    return GM_addStyle(t), t;
  };
  cssLoader("ElementPlus");
  Function.prototype.__constructor_back = Function.prototype.constructor;
  Function.prototype.constructor = function() {
    if (arguments && typeof arguments[0] === "string") {
      if ("debugger" === arguments[0]) {
        return;
      }
    }
    return Function.prototype.__constructor_back.apply(this, arguments);
  };
  let questionData = {
    question: "按化学成份分类,压力容器用钢可分为",
    options: ["常开", "时开时闭", "常闭"],
    type: 0
  };
  Answer.getAnswer1(questionData);
  _unsafeWindow.onload = async () => {
    const pinia = createPinia();
    const app = vue.createApp(_sfc_main);
    app.use(ElementPlus);
    app.use(pinia);
    app.mount(
      (() => {
        const app2 = document.createElement("div");
        app2.id = "AiAskApp";
        document.body.append(app2);
        return app2;
      })()
    );
  };

})(Vue, $, ElementPlus);